rama_http::layer::validate_request

Trait ValidateRequest

Source
pub trait ValidateRequest<S, B>:
    Send
    + Sync
    + 'static {
    type ResponseBody;

    // Required method
    fn validate(
        &self,
        ctx: Context<S>,
        request: Request<B>,
    ) -> impl Future<Output = Result<(Context<S>, Request<B>), Response<Self::ResponseBody>>> + Send + '_;
}
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( &self, ctx: Context<S>, request: Request<B>, ) -> impl Future<Output = Result<(Context<S>, Request<B>), Response<Self::ResponseBody>>> + Send + '_

Validate the request.

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S, B, A, F> ValidateRequest<S, B> for BoxValidateRequestFn<F, A>
where A: Send + Sync + 'static, F: ValidateRequestFn<S, B, A>,

Source§

impl<S, B, ResBody> ValidateRequest<S, B> for AuthorizeContext<Basic<ResBody>>
where ResBody: Default + Send + 'static, B: Send + 'static, S: Clone + Send + Sync + 'static,

Source§

type ResponseBody = ResBody

Source§

impl<S, B, ResBody> ValidateRequest<S, B> for AuthorizeContext<Bearer<ResBody>>
where ResBody: Default + Send + 'static, B: Send + 'static, S: Clone + Send + Sync + 'static,

Source§

type ResponseBody = ResBody

Source§

impl<S, B, ResBody> ValidateRequest<S, B> for AcceptHeader<ResBody>
where S: Clone + Send + Sync + 'static, B: Send + Sync + 'static, ResBody: Default + Send + 'static,

Source§

type ResponseBody = ResBody