mirror of
https://github.com/django/daphne.git
synced 2025-07-10 16:02:18 +03:00
Fix streaming responses (e.g. staticfiles.serve)
This commit is contained in:
parent
e666355fad
commit
247a26b91a
|
@ -242,8 +242,10 @@ class AsgiHandler(base.BaseHandler):
|
||||||
# Streaming responses need to be pinned to their iterator
|
# Streaming responses need to be pinned to their iterator
|
||||||
if response.streaming:
|
if response.streaming:
|
||||||
for part in response.streaming_content:
|
for part in response.streaming_content:
|
||||||
for chunk in cls.chunk_bytes(part):
|
for chunk, more in cls.chunk_bytes(part):
|
||||||
message['content'] = chunk
|
message['content'] = chunk
|
||||||
|
# We ignore "more" as there may be more parts; instead,
|
||||||
|
# we use an empty final closing message with False.
|
||||||
message['more_content'] = True
|
message['more_content'] = True
|
||||||
yield message
|
yield message
|
||||||
message = {}
|
message = {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user