Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note about updating headers in on_response_prepare #7283

Merged
merged 3 commits into from May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/7283.doc
@@ -0,0 +1 @@
Added a note about possibly needing to update headers when using ``on_response_prepare`` -- by :user:`Dreamsorcerer`
7 changes: 7 additions & 0 deletions docs/web_reference.rst
Expand Up @@ -1392,6 +1392,13 @@ duplicated like one using :meth:`~aiohttp.web.Application.copy`.
async def on_prepare(request, response):
pass

.. note::

The headers are written immediately after these callbacks are run.
Therefore, if you modify the content of the response, you may need to
adjust the `Content-Length` header or similar to match. Aiohttp will
not make any updates to the headers from this point.

.. attribute:: on_startup

A :class:`~aiosignal.Signal` that is fired on application start-up.
Expand Down