Struct reqwest::header::Headers [] [src]

pub struct Headers { /* fields omitted */ }

A map of header fields on requests and responses.

Methods

impl Headers

Creates a new, empty headers map.

Set a header field to the corresponding value.

The field is determined by the type of the value being set.

Access the raw value of a header.

Prefer to use the typed getters instead.

Example:

let raw_content_type = headers.get_raw("content-type");Run

Set the raw value of a header, bypassing any typed headers.

Example:

headers.set_raw("content-length", vec![b"5".to_vec()]);Run

Remove a header set by set_raw

Get a reference to the header field's value, if it exists.

Get a mutable reference to the header field's value, if it exists.

Returns a boolean of whether a certain header is in the map.

Example:

let has_type = headers.has::<ContentType>();Run

Removes a header from the map, if one existed. Returns true if a header has been removed.

Returns an iterator over the header fields.

Returns the number of headers in the map.

Remove all headers from the map.

Trait Implementations

impl Display for Headers

impl Debug for Headers

Formats the value using the given formatter.

impl PartialEq<Headers> for Headers

impl Clone for Headers

impl<'a> FromIterator<HeaderView<'a>> for Headers

impl<'a> Extend<HeaderView<'a>> for Headers