pub trait SputnikParts {
    fn query<'a, X: Deserialize<'a>>(&'a self) -> Result<X, QueryError>;
    fn cookies(&self) -> CookieIter<'_>Notable traits for CookieIter<'a>impl<'a> Iterator for CookieIter<'a>    type Item = (&'a str, &'a str);;
    fn enforce_content_type(
        &self,
        mime: Mime
    ) -> Result<(), WrongContentTypeError>; fn response_headers(&mut self) -> &mut HeaderMap; }
Expand description

Adds convenience methods to http::request::Parts.

Required Methods

Parses the query string of the request into a given struct.

Parses the cookies of the request.

Enforces a specific Content-Type.

A map of response headers to allow methods of this trait to set response headers without needing to take a Response as an argument.

You need to take care to append these headers to the response yourself. This is intended to be done after your routing logic so that your individual request handlers don’t have to worry about it.

Implementations on Foreign Types

Implementors