mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #25725 -- Made HttpReponse immediately close objects.
This commit is contained in:
parent
a6c803a2e3
commit
5233b70070
5 changed files with 29 additions and 18 deletions
|
@ -608,11 +608,17 @@ Passing iterators
|
|||
|
||||
Finally, you can pass ``HttpResponse`` an iterator rather than strings.
|
||||
``HttpResponse`` will consume the iterator immediately, store its content as a
|
||||
string, and discard it.
|
||||
string, and discard it. Objects with a ``close()`` method such as files and
|
||||
generators are immediately closed.
|
||||
|
||||
If you need the response to be streamed from the iterator to the client, you
|
||||
must use the :class:`StreamingHttpResponse` class instead.
|
||||
|
||||
.. versionchanged:: 1.10
|
||||
|
||||
Objects with a ``close()`` method used to be closed when the WSGI server
|
||||
called ``close()`` on the response.
|
||||
|
||||
Setting header fields
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue