Added some documentation to request.py, removed extra line in blueprints.py, and minor grammar enhancements to blueprints.md and middleware.md
This commit is contained in:
parent
0148d65dd2
commit
3c7a8a5f45
|
@ -3,7 +3,7 @@
|
||||||
Blueprints are objects that can be used for sub-routing within an application.
|
Blueprints are objects that can be used for sub-routing within an application.
|
||||||
Instead of adding routes to the application object, blueprints define similar
|
Instead of adding routes to the application object, blueprints define similar
|
||||||
methods for adding routes, which are then registered with the application in a
|
methods for adding routes, which are then registered with the application in a
|
||||||
flexible and plugable manner.
|
flexible and pluggable manner.
|
||||||
|
|
||||||
## Why?
|
## Why?
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Middleware
|
# 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.
|
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 middleware(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def register_middleware(middleware):
|
def register_middleware(middleware):
|
||||||
self.record(lambda s: s.add_middleware(middleware, *args, **kwargs))
|
self.record(lambda s: s.add_middleware(middleware, *args, **kwargs))
|
||||||
return middleware
|
return middleware
|
||||||
|
|
|
@ -26,6 +26,9 @@ class RequestParameters(dict):
|
||||||
|
|
||||||
|
|
||||||
class Request:
|
class Request:
|
||||||
|
"""
|
||||||
|
Properties of an HTTP request such as URL, headers, etc.
|
||||||
|
"""
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
'url', 'headers', 'version', 'method',
|
'url', 'headers', 'version', 'method',
|
||||||
'query_string', 'body',
|
'query_string', 'body',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user