tower_http::validate_request

Trait ValidateRequest

source
pub trait ValidateRequest<B> {
    type ResponseBody;

    // Required method
    fn validate(
        &mut self,
        request: &mut Request<B>,
    ) -> Result<(), Response<Self::ResponseBody>>;
}
Expand description

Trait for validating requests.

Required Associated Types§

source

type ResponseBody

The body type used for responses to unvalidated requests.

Required Methods§

source

fn validate( &mut self, request: &mut Request<B>, ) -> Result<(), Response<Self::ResponseBody>>

Validate the request.

If Ok(()) is returned then the request is allowed through, otherwise not.

Implementors§

source§

impl<B, F, ResBody> ValidateRequest<B> for F
where F: FnMut(&mut Request<B>) -> Result<(), Response<ResBody>>,

source§

type ResponseBody = ResBody

source§

impl<B, ResBody> ValidateRequest<B> for Basic<ResBody>
where ResBody: Default,

source§

type ResponseBody = ResBody

source§

impl<B, ResBody> ValidateRequest<B> for Bearer<ResBody>
where ResBody: Default,

source§

type ResponseBody = ResBody

source§

impl<B, ResBody> ValidateRequest<B> for AcceptHeader<ResBody>
where ResBody: Default,

source§

type ResponseBody = ResBody