Middleware module reference¶
- class micro.web.middleware.Middleware[source]¶
A base class for middlewares. Inherit from this to define your own middlewares.
- static exception(request, exception)[source]¶
Processes the exception happened during the request handling.
Parameters: - request (micro.web.request.Request) – An incoming request instance
- exception (Exception) – An exception instance
Returns: None or response to write
- static request(request)[source]¶
Invoked right after the request initialization, before routing call.
Parameters: request (micro.web.request.Request) – An incoming request instance. Returns: None or response to write
- static response(request, response, result)[source]¶
Invoked after the result for response is got from request handler.
Parameters: - request (micro.web.request.Request) – An incoming request instance
- response (aiohttp.web_reqrep.StreamResponse) – An outcoming response instance, StreamResponse subclass
- result (mixed) – A result of request handler
Returns: None or response to write
- static route_match(request, match_info)[source]¶
Invoked right after the routing initialization, if the matching route is found.
Parameters: - request (micro.web.request.Request) – An incoming request instance.
- match_info (aiohttp.web_urldispatcher.UrlMappingMatchInfo) – An aiohttp`s match info object
Returns: None or response to write