Trait actix_http::HttpMessage

source ·
pub trait HttpMessage: Sized {
    type Stream;

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

    // Provided methods
    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§

source

type Stream

Type of message payload stream

Required Methods§

source

fn headers(&self) -> &HeaderMap

Read the message headers.

source

fn take_payload(&mut self) -> Payload<Self::Stream>

Message payload stream

source

fn extensions(&self) -> Ref<'_, Extensions>

Returns a reference to the request-local data/extensions container.

source

fn extensions_mut(&self) -> RefMut<'_, Extensions>

Returns a mutable reference to the request-local data/extensions container.

Provided Methods§

source

fn content_type(&self) -> &str

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

source

fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>

Get content type encoding.

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

source

fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>

Convert the request content type to a known mime type.

source

fn chunked(&self) -> Result<bool, ParseError>

Check if request has chunked transfer encoding.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, T> HttpMessage for &'a mut T
where T: HttpMessage,

source§

fn take_payload(&mut self) -> Payload<Self::Stream>

Message payload stream

source§

fn extensions(&self) -> Ref<'_, Extensions>

Request’s extensions container

source§

fn extensions_mut(&self) -> RefMut<'_, Extensions>

Mutable reference to a the request’s extensions container

§

type Stream = <T as HttpMessage>::Stream

source§

fn headers(&self) -> &HeaderMap

Implementors§

source§

impl<P> HttpMessage for Request<P>

§

type Stream = P