Clarify arguments to request/response middleware

This commit is contained in:
Charles-Axel Dein 2018-03-21 12:07:26 +01:00 committed by GitHub
parent c4c4ed70d9
commit 3dfb31b1b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,9 +10,10 @@ Additionally, Sanic provides listeners which allow you to run code at various po
There are two types of middleware: request and response. Both are declared There are two types of middleware: request and response. Both are declared
using the `@app.middleware` decorator, with the decorator's parameter being a using the `@app.middleware` decorator, with the decorator's parameter being a
string representing its type: `'request'` or `'response'`. Response middleware string representing its type: `'request'` or `'response'`.
receives both the request and the response as arguments.
* Request middleware receives only the `request` as argument.
* Response middleware receives both the `request` and `response`.
The simplest middleware doesn't modify the request or response at all: The simplest middleware doesn't modify the request or response at all: