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§
Sourcefn set_header(&mut self, header: HeaderName, value: HeaderValue)
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.
Sourcefn compute_digest(&mut self, digest: &dyn HttpDigest) -> Option<String>
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§
Sourcefn host(&self) -> Option<String>
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.