Skip to main content

HasHeaders

Trait HasHeaders 

Source
pub trait HasHeaders {
    // Required method
    fn headers(&self) -> &HeaderMap;
}
Expand description

Trait for types that provide access to HTTP headers.

Implement this trait to enable header predicates on custom types. Both CacheableHttpRequest and CacheableHttpResponse implement this trait.

§For Implementors

Return a reference to the headers associated with the HTTP message. The returned headers should reflect the current state of the message and remain valid for the lifetime of the borrow.

§For Callers

Use this trait to access headers generically from either requests or responses. Header predicates use this to inspect headers without knowing the concrete message type.

Required Methods§

Source

fn headers(&self) -> &HeaderMap

Returns a reference to the HTTP headers.

Implementors§

Source§

impl<ReqBody> HasHeaders for CacheableHttpRequest<ReqBody>
where ReqBody: HttpBody,

Source§

impl<ResBody> HasHeaders for CacheableHttpResponse<ResBody>
where ResBody: HttpBody,