RequestMiddleware

Trait RequestMiddleware 

Source
pub trait RequestMiddleware:
    Send
    + Sync
    + Debug {
    // Required methods
    fn process_request<'life0, 'life1, 'async_trait>(
        &'life0 self,
        context: &'life1 mut RequestContext,
    ) -> Pin<Box<dyn Future<Output = MiddlewareResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn name(&self) -> &str;
}
Expand description

Trait for request middleware

Request middleware can modify the request before it’s sent to the server. They are executed in the order they are registered.

Required Methods§

Source

fn process_request<'life0, 'life1, 'async_trait>( &'life0 self, context: &'life1 mut RequestContext, ) -> Pin<Box<dyn Future<Output = MiddlewareResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Process the request context

§Arguments
  • context - Mutable request context that can be modified
§Returns

Returns Ok(()) to continue processing, or PluginError to abort.

Source

fn name(&self) -> &str

Get middleware name for debugging

Implementors§