Struct susanoo::Context
[−]
[src]
pub struct Context { pub req: Request, pub params: OwnedCaptures, pub body: Option<Body>, pub handle: Remote, pub ext: SendMap, // some fields omitted }
A context during handling.
It contains an HTTP request, HTTP response to return, and a typemap in order to share variables between middlewares.
Fields
req: Request
Incoming request contains URI, method, headers, and body
params: OwnedCaptures
Captured parameters from router
body: Option<Body>
Request body
handle: Remote
Handle of event loop
ext: SendMap
Extension map to share values between handlers/middlewares
Methods
impl Context
[src]
fn respond<R: Responder>(self, responder: R) -> Outcome<Response>
fn next(self) -> Outcome<Context>
fn halt<T>(self, err: HandleError) -> Outcome<T>
fn on_send<F>(&mut self, on_send: F) -> &mut Self where
F: Fn(&mut RawResponse) + Send + 'static,
F: Fn(&mut RawResponse) + Send + 'static,
Register a callback function called after construct response.