Skip to main content

ResponseMiddleware

Trait ResponseMiddleware 

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

Required Methods§

Source

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

Source

fn on_response<'life0, 'life1, 'async_trait>( &'life0 self, resp: Response, cx: &'life1 mut Context, ) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Inspect or transform the response. Always returns a Response — replacing one variant with another is how a middleware swaps the result.

Implementors§