Trait seamless::handler::body::HandlerBody[][src]

pub trait HandlerBody: Sized {
    fn handler_body<'life0, 'async_trait>(
        req: Request<&'life0 mut dyn AsyncReadBody>
    ) -> Pin<Box<dyn Future<Output = Result<Self, ApiError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn handler_method() -> Method { ... } }
Expand description

This trait is implemented by anything that represents the incoming request type. Only one argument implementing this can be asked for in a given handler. The type that implements this is used to determine the input type expected by the handler for the sake of generating API information.

Required methods

Given a request containing arbitrary bytes, this function needs to return an instance of the type that this trait is implemented on (typically by deserializing it from the bytes provided), or else it should return an error describing what went wrong.

Provided methods

Which HTTP method is required for this Body to be valid. By default, if a body is present in the handler we’ll expect the method to be POST. Implement this function to override that.

Implementors