Documentation for pulsar 0.9.2. For development docs, go here.
A WSGI Middleware is a function or callable object similar to a
WSGI application handlers
with the only difference that it can return nothing (None
).
Middleware can be used in conjunction with a WsgiHandler or any other handler which iterate through a list of middleware in a similar way (for example django wsgi handler).
Important
An asynchronous WSGI middleware is a callble accepting a WSGI
environ
and start_response
as the only input paramaters and
it must returns an asynchronous iterator
or nothing.
The two most important wsgi middleware in pulsar are:
In addition, pulsar provides with the following four middlewares which don’t serve requests, instead they perform initialisation and sanity checks.
Parse the HTTP_AUTHORIZATION
key in the environ
.
If available, set the http.authorization
key in environ
with
the result obtained from parse_authorization_header()
function.
pulsar.apps.wsgi.middleware.
wait_for_body_middleware
(environ, start_response=None)[source]¶Use this middleware to wait for the full body.
This middleware wait for the full body to be received before letting other middleware to be processed.
Useful when using synchronous web-frameworks such as django.