diff --git a/changes/2225.doc b/changes/2225.doc new file mode 100644 index 00000000000..3363be9b366 --- /dev/null +++ b/changes/2225.doc @@ -0,0 +1 @@ +Document that all app's middleware factories are run for every request. diff --git a/docs/web.rst b/docs/web.rst index 0dd6ff83f23..ec24a2bb410 100644 --- a/docs/web.rst +++ b/docs/web.rst @@ -904,6 +904,11 @@ the **next** *middleware factory*. The last *middleware factory* always receives the :ref:`request handler ` selected by the router itself (by :meth:`UrlDispatcher.resolve`). +.. note:: + + Both the outer *middleware_factory* coroutine and the inner + *middleware_handler* coroutine are called for every request handled. + *Middleware factories* should return a new handler that has the same signature as a :ref:`request handler `. That is, it should accept a single :class:`Request` instance and return a :class:`Response`, or raise an