rama::http::layer::validate_request

Trait ValidateRequest

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§

type ResponseBody

The body type used for responses to unvalidated requests.

Required Methods§

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.

Object Safety§

This trait is not object safe.

Implementors§

§

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

§

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

§

type ResponseBody = ResBody

§

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

§

type ResponseBody = ResBody

§

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

§

type ResponseBody = ResBody