WSGI Protocol Linter

This module provides a middleware that performs sanity checks on the behavior of the WSGI server and application. It checks that the PEP 3333 WSGI spec is properly implemented. It also warns on some common HTTP errors such as non-empty responses for 304 status codes.

class werkzeug.middleware.lint.LintMiddleware(app)

Warns about common errors in the WSGI and HTTP behavior of the server and wrapped application. Some of the issues it checks are:

  • invalid status codes

  • non-bytes sent to the WSGI server

  • strings returned from the WSGI application

  • non-empty conditional responses

  • unquoted etags

  • relative URLs in the Location header

  • unsafe calls to wsgi.input

  • unclosed iterators

Error information is emitted using the warnings module.

Parameters:

app (WSGIApplication) – The WSGI application to wrap.

from werkzeug.middleware.lint import LintMiddleware
app = LintMiddleware(app)