Struct tk_http::client::Head
[−]
[src]
pub struct Head<'a> { /* fields omitted */ }
A borrowed structure that represents response headers
It's passed to Codec::headers_received
and you are free to store or
discard any needed fields and headers from it.
Methods
impl<'a> Head<'a>
[src]
fn status(&self) -> Option<Status>
[src]
Returns status if it is one of the supported statuses otherwise None
Note: this method does not consider "reason" string at all just status code. Which is fine as specification states.
fn raw_status(&self) -> (u16, &'a str)
[src]
Returns raw status code and reason as received even
This returns something even if status()
returned None
.
Note: the reason string may not match the status code or may even be an empty string.
fn headers(&self) -> HeaderIter
[src]
Iterator over the headers of HTTP request
This iterator strips the following kinds of headers:
- Hop-by-hop headers (
Connection
itself, and ones it enumerates) Content-Length
andTransfer-Encoding
You may use all_headers()
if you really need to access to all of
them (mostly useful for debugging puproses). But you may want to
consider:
- Payload size can be fetched using
body_length()
method. Note: this also includes cases where length is implicitly set to zero. Connection
header might be discovered withconnection_close()
orconnection_header()
fn all_headers(&self) -> &'a [Header<'a>]
[src]
All headers of HTTP request
Unlike self.headers()
this does include hop-by-hop headers. This
method is here just for completeness, you shouldn't need it.