Skip to main content

RequestMiddleware

Trait RequestMiddleware 

Source
pub trait RequestMiddleware: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn on_request<'life0, 'life1, 'async_trait>(
        &'life0 self,
        req: Request,
        cx: &'life1 mut Context,
    ) -> Pin<Box<dyn Future<Output = Flow> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn name(&self) -> &'static str

Stable identifier used for info! registration logs and test introspection. Return a &'static str literal.

Source

fn on_request<'life0, 'life1, 'async_trait>( &'life0 self, req: Request, cx: &'life1 mut Context, ) -> Pin<Box<dyn Future<Output = Flow> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Inspect or transform the request. Variants the middleware does not care about return Flow::Continue(req) unchanged.

Implementors§