[][src]Trait sputnik::request::SputnikBody

pub trait SputnikBody {
#[must_use]    fn into_bytes<'async_trait>(
        self
    ) -> Pin<Box<dyn Future<Output = Result<Bytes, BodyError>> + Send + 'async_trait>>
    where
        Self: 'async_trait
;
#[must_use] fn into_form<'async_trait, T: DeserializeOwned>(
        self
    ) -> Pin<Box<dyn Future<Output = Result<T, FormError>> + Send + 'async_trait>>
    where
        T: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn into_form_csrf<'life0, 'async_trait, T: DeserializeOwned>(
        self,
        req: &'life0 mut Parts
    ) -> Pin<Box<dyn Future<Output = Result<T, CsrfProtectedFormError>> + Send + 'async_trait>>
    where
        T: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn into_json<'async_trait, T: DeserializeOwned>(
        self
    ) -> Pin<Box<dyn Future<Output = Result<T, JsonError>> + Send + 'async_trait>>
    where
        T: 'async_trait,
        Self: 'async_trait
; }

Required methods

#[must_use]fn into_bytes<'async_trait>(
    self
) -> Pin<Box<dyn Future<Output = Result<Bytes, BodyError>> + Send + 'async_trait>> where
    Self: 'async_trait, 
[src]

#[must_use]fn into_form<'async_trait, T: DeserializeOwned>(
    self
) -> Pin<Box<dyn Future<Output = Result<T, FormError>> + Send + 'async_trait>> where
    T: 'async_trait,
    Self: 'async_trait, 
[src]

Parses a application/x-www-form-urlencoded request body into a given struct.

This does make you vulnerable to CSRF, so you normally want to use SputnikBody::into_form_csrf() instead.

#[must_use]fn into_form_csrf<'life0, 'async_trait, T: DeserializeOwned>(
    self,
    req: &'life0 mut Parts
) -> Pin<Box<dyn Future<Output = Result<T, CsrfProtectedFormError>> + Send + 'async_trait>> where
    T: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Parses a application/x-www-form-urlencoded request body into a given struct. Protects from CSRF by checking that the request body contains the same token retrieved from the cookies.

The HTML form must embed a hidden input generated with CsrfToken::html_input.

#[must_use]fn into_json<'async_trait, T: DeserializeOwned>(
    self
) -> Pin<Box<dyn Future<Output = Result<T, JsonError>> + Send + 'async_trait>> where
    T: 'async_trait,
    Self: 'async_trait, 
[src]

This is supported on crate feature json only.

Attempts to deserialize the request body as JSON.

Loading content...

Implementations on Foreign Types

impl SputnikBody for Body[src]

Loading content...

Implementors

Loading content...