Trait ClientRequestLike

Source
pub trait ClientRequestLike: RequestLike {
    // Required methods
    fn set_header(&mut self, header: HeaderName, value: HeaderValue);
    fn compute_digest(&mut self, digest: &dyn HttpDigest) -> Option<String>;

    // Provided method
    fn host(&self) -> Option<String> { ... }
}
Expand description

This trait is to be implemented for types representing an outgoing HTTP request. The HTTP signing extension methods are available on any type implementing this trait.

Required Methods§

Source

fn set_header(&mut self, header: HeaderName, value: HeaderValue)

Add a header to the request. This function may be used to set the Date and Digest headers if not already present depending on the configuration. The Authorization header will always be set assuming the message was signed successfully.

Source

fn compute_digest(&mut self, digest: &dyn HttpDigest) -> Option<String>

Compute the digest using the provided HTTP digest algorithm. If this is not possible, then return None. This may require buffering the request data into memory.

Provided Methods§

Source

fn host(&self) -> Option<String>

Returns the host for the request (eg. “example.com”, “127.0.0.1:8080”) in case the Host header has not been set explicitly. Note, the correct form of the Host header is <host>:<port> if the port is non-standard for the protocol used (e.g., 443 for an HTTPS URL, and 80 for an HTTP URL). When implementing this trait, do not just read the Host header from the request - this method will only be called when the Host header is not set.

Implementations on Foreign Types§

Source§

impl ClientRequestLike for Request

Source§

fn host(&self) -> Option<String>

Source§

fn compute_digest(&mut self, digest: &dyn HttpDigest) -> Option<String>

Source§

fn set_header(&mut self, header: HeaderName, value: HeaderValue)

Source§

impl ClientRequestLike for Request

Source§

fn host(&self) -> Option<String>

Source§

fn compute_digest(&mut self, digest: &dyn HttpDigest) -> Option<String>

Source§

fn set_header(&mut self, header: HeaderName, value: HeaderValue)

Implementors§