pub trait HeaderMapExt {
Show 21 methods
// Required methods
fn content_type(&self) -> Option<ContentType>;
fn content_length(&self) -> Option<u64>;
fn authorization(&self) -> Option<&str>;
fn accept(&self) -> Option<&str>;
fn host(&self) -> Option<&str>;
fn user_agent(&self) -> Option<&str>;
fn cache_control(&self) -> Option<&str>;
fn etag(&self) -> Option<&str>;
fn if_none_match(&self) -> Option<&str>;
fn if_modified_since(&self) -> Option<&str>;
fn cookie_header(&self) -> Option<&str>;
fn location(&self) -> Option<&str>;
fn referer(&self) -> Option<&str>;
fn set_content_type(&mut self, ct: &ContentType) -> Result<(), OxiHttpError>;
fn set_content_length(&mut self, len: u64) -> Result<(), OxiHttpError>;
fn set_bearer_auth(&mut self, token: &str) -> Result<(), OxiHttpError>;
fn set_basic_auth(
&mut self,
username: &str,
password: Option<&str>,
) -> Result<(), OxiHttpError>;
fn set_cache_control(&mut self, value: &str) -> Result<(), OxiHttpError>;
fn set_etag(&mut self, value: &str) -> Result<(), OxiHttpError>;
fn set_location(&mut self, value: &str) -> Result<(), OxiHttpError>;
fn set_cookie_header(&mut self, value: &str) -> Result<(), OxiHttpError>;
}Expand description
Extension trait providing typed accessors for common HTTP headers.
Required Methods§
Sourcefn content_type(&self) -> Option<ContentType>
fn content_type(&self) -> Option<ContentType>
Get the Content-Type header as a parsed ContentType.
Sourcefn content_length(&self) -> Option<u64>
fn content_length(&self) -> Option<u64>
Get the Content-Length header as a u64.
Get the Authorization header value.
Sourcefn user_agent(&self) -> Option<&str>
fn user_agent(&self) -> Option<&str>
Get the User-Agent header value.
Sourcefn cache_control(&self) -> Option<&str>
fn cache_control(&self) -> Option<&str>
Get the Cache-Control header value.
Sourcefn if_none_match(&self) -> Option<&str>
fn if_none_match(&self) -> Option<&str>
Get the If-None-Match header value.
Sourcefn if_modified_since(&self) -> Option<&str>
fn if_modified_since(&self) -> Option<&str>
Get the If-Modified-Since header value.
Get the raw Cookie header value (not parsed).
Sourcefn set_content_type(&mut self, ct: &ContentType) -> Result<(), OxiHttpError>
fn set_content_type(&mut self, ct: &ContentType) -> Result<(), OxiHttpError>
Set a typed Content-Type header.
Sourcefn set_content_length(&mut self, len: u64) -> Result<(), OxiHttpError>
fn set_content_length(&mut self, len: u64) -> Result<(), OxiHttpError>
Set a Content-Length header.
Sourcefn set_bearer_auth(&mut self, token: &str) -> Result<(), OxiHttpError>
fn set_bearer_auth(&mut self, token: &str) -> Result<(), OxiHttpError>
Set a Bearer authorization header.
Sourcefn set_basic_auth(
&mut self,
username: &str,
password: Option<&str>,
) -> Result<(), OxiHttpError>
fn set_basic_auth( &mut self, username: &str, password: Option<&str>, ) -> Result<(), OxiHttpError>
Set a Basic authorization header from username and password.
Sourcefn set_cache_control(&mut self, value: &str) -> Result<(), OxiHttpError>
fn set_cache_control(&mut self, value: &str) -> Result<(), OxiHttpError>
Set the Cache-Control header.
Sourcefn set_location(&mut self, value: &str) -> Result<(), OxiHttpError>
fn set_location(&mut self, value: &str) -> Result<(), OxiHttpError>
Set the Location header.
Append a Set-Cookie header value (uses append per RFC 6265).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".