logo
pub trait HttpMessage: Sized {
    type Stream;

    fn headers(&self) -> &HeaderMap;
    fn take_payload(&mut self) -> Payload<Self::Stream>;
    fn extensions(&self) -> Ref<'_, Extensions>;
    fn extensions_mut(&self) -> RefMut<'_, Extensions>;

    fn content_type(&self) -> &str { ... }
    fn encoding(&self) -> Result<&'static Encoding, ContentTypeError> { ... }
    fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError> { ... }
    fn chunked(&self) -> Result<bool, ParseError> { ... }
}
Expand description

Trait that implements general purpose operations on HTTP messages.

Required Associated Types

Type of message payload stream

Required Methods

Read the message headers.

Message payload stream

Request’s extensions container

Mutable reference to a the request’s extensions container

Provided Methods

Read the request content type. If request did not contain a Content-Type header, an empty string is returned.

Get content type encoding

UTF-8 is used by default, If request charset is not set.

Convert the request content type to a known mime type.

Check if request has chunked transfer encoding.

Implementations on Foreign Types

Message payload stream

Request’s extensions container

Mutable reference to a the request’s extensions container

Implementors