Struct seamless::handler::body::Capped [−][src]
pub struct Capped<T: ApiBody + HandlerBody, const MAX_BYTES: usize>(pub T);
Expand description
This wraps anything implementing HandlerBody
and puts a type level cap on the size
that the request body is allowed to be before this is rejected. This works best when the
request body is streamed, as it will stop the streaming once said limit is reached.
Tuple Fields
0: T
Trait Implementations
This returns information about the shape of the type and description of parts of it.
Serialize the type to JSON.
Serialize the type to a serde_json::Value
.
Deserialize from bytes containing a JSON value.
Deserialize from a serde_json::Value
.
fn handler_body<'a, 'async_trait>(
req: Request<&'a mut dyn AsyncReadBody>
) -> Pin<Box<dyn Future<Output = Result<Self, ApiError>> + Send + 'async_trait>> where
'a: 'async_trait,
Self: 'async_trait,
fn handler_body<'a, 'async_trait>(
req: Request<&'a mut dyn AsyncReadBody>
) -> Pin<Box<dyn Future<Output = Result<Self, ApiError>> + Send + 'async_trait>> where
'a: 'async_trait,
Self: 'async_trait,
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. Read more
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. Read more