Trait saphir::Middleware
source · pub trait Middleware: Send + Sync {
fn resolve(
&self,
req: &mut SyncRequest,
res: &mut SyncResponse
) -> RequestContinuation;
}
Expand description
The trait a struct need to impl
to be considered as a middleware
Required Methods
sourcefn resolve(
&self,
req: &mut SyncRequest,
res: &mut SyncResponse
) -> RequestContinuation
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.