Merge branch 'master' of github.com:mindflayer/sanic
This commit is contained in:
commit
2ee4c0fc6a
|
@ -3,7 +3,7 @@
|
|||
Blueprints are objects that can be used for sub-routing within an application.
|
||||
Instead of adding routes to the application object, blueprints define similar
|
||||
methods for adding routes, which are then registered with the application in a
|
||||
flexible and plugable manner.
|
||||
flexible and pluggable manner.
|
||||
|
||||
## Why?
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Middleware
|
||||
|
||||
Middleware can be executed before or after requests. It is executed in the order it was registered. If middleware return a response object, the request will stop processing and a response will be returned.
|
||||
Middleware can be executed before or after requests. It is executed in the order it was registered. If middleware returns a response object, the request will stop processing and a response will be returned.
|
||||
|
||||
Middleware is registered via the middleware decorator, and can either be added as 'request' or 'response' middleware, based on the argument provided in the decorator. Response middleware receives both the request and the response as arguments.
|
||||
|
||||
|
|
|
@ -76,7 +76,6 @@ class Blueprint:
|
|||
def middleware(self, *args, **kwargs):
|
||||
"""
|
||||
"""
|
||||
|
||||
def register_middleware(middleware):
|
||||
self.record(lambda s: s.add_middleware(middleware, *args, **kwargs))
|
||||
return middleware
|
||||
|
|
|
@ -26,6 +26,9 @@ class RequestParameters(dict):
|
|||
|
||||
|
||||
class Request:
|
||||
"""
|
||||
Properties of an HTTP request such as URL, headers, etc.
|
||||
"""
|
||||
__slots__ = (
|
||||
'url', 'headers', 'version', 'method',
|
||||
'query_string', 'body',
|
||||
|
|
Loading…
Reference in New Issue
Block a user