mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #31240 -- Properly closed FileResponse when wsgi.file_wrapper is used.
Thanks to Oskar Persson for the report.
This commit is contained in:
parent
549445519c
commit
41a3b3d186
7 changed files with 63 additions and 6 deletions
15
tests/builtin_server/views.py
Normal file
15
tests/builtin_server/views.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
from io import BytesIO
|
||||
|
||||
from django.http import FileResponse
|
||||
|
||||
FILE_RESPONSE_HOLDER = {}
|
||||
|
||||
|
||||
def file_response(request):
|
||||
f1 = BytesIO(b"test1")
|
||||
f2 = BytesIO(b"test2")
|
||||
response = FileResponse(f1)
|
||||
response._resource_closers.append(f2.close)
|
||||
FILE_RESPONSE_HOLDER['response'] = response
|
||||
FILE_RESPONSE_HOLDER['buffers'] = (f1, f2)
|
||||
return response
|
Loading…
Add table
Add a link
Reference in a new issue