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>>;
}
Available on crate feature validate-request only.
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,

Available on crate feature auth only.
Source§

type ResponseBody = ResBody

Source§

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

Available on crate feature auth only.
Source§

type ResponseBody = ResBody

Source§

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

Source§

type ResponseBody = ResBody