[][src]Trait saphir::middleware::Middleware

pub trait Middleware: Send + Sync {
    fn resolve(
        &self,
        req: &mut SyncRequest,
        res: &mut SyncResponse
    ) -> RequestContinuation; }

The trait a struct need to impl to be considered as a middleware

Required methods

fn resolve(
    &self,
    req: &mut SyncRequest,
    res: &mut SyncResponse
) -> RequestContinuation

This method will be invoked if the request is targeting an included path, (as defined when "applying" the middleware to the stack) and doesn't match any exclusion. Returning RequestContinuation::Continue will allow the request to continue through the stack, and returning RequestContinuation::Stop will cease the request processing, returning as response the modified res param.

Loading content...

Implementors

Loading content...