Skip to main content

bind_validated

Function bind_validated 

Source
pub fn bind_validated<V, E, H, Args>(
    handler: H,
) -> BoundHandler<Validated<V, E>>
where V: Validate<E::Req>, E: BindableEndpoint + HasReqType, E::Req: DeserializeOwned + Send + 'static, H: Handler<Args>, Args: 'static,
Expand description

Bind a handler to a Validated<V, E> endpoint.

Deserializes the request body, runs the validator, and only calls the handler if validation passes. Returns 422 on validation failure.