Documentation for pulsar 0.7.2. For development docs, go here.
A WSGI Middleware is a function or callable object similar to WSGI application handlers with the only difference that they can return 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).
Here we introduce the Router and MediaRouter to handle requests on given urls. Pulsar is shipped with additional wsgi middleware for manipulating the environment before a client response is returned.
An asynchronous WSGI middleware is a callble accepting a WSGI environ and start_response as the only input paramaters. It must returns an asynchronous iterator or nothing.
The two most important wsgi middleware in pulsar are:
In addition, there are several WSGI middlewares which don’t serve request but instead perform initialisation and sanity checks.
Clean url from double slashes and redirect if needed.
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.
Base class for response middlewares.
The focus of this class is the execute() method where the middleware logic is implemented.
Check if this ResponseMiddleware can be applied to the response object.
True or False.
A ResponseMiddleware for compressing content if the request allows gzip compression. It sets the Vary header accordingly.
The compression implementation is from http://jython.xhaus.com/http-compression-in-python-and-jython