Trait HttpRequestBody

Source
pub trait HttpRequestBody {
    // Required method
    fn to_vec(&self) -> Result<Vec<u8>, Error>;

    // Provided method
    fn apply_headers(&self, _headers: &mut HeaderMap) { ... }
}
Expand description

Trait defined on every body type that can be used with crate::HttpRequest.

Required Methods§

Source

fn to_vec(&self) -> Result<Vec<u8>, Error>

Convert the request contents to a Vec<u8>.

§Errors

If the conversion to the Vec goes wrong, this will be indicated by returning an appropriate Error.

Provided Methods§

Source

fn apply_headers(&self, _headers: &mut HeaderMap)

Apply the headers that this body requires for the request to be valid. This will usually add a http::header::CONTENT_TYPE header.

Implementors§