From 247a26b91a9e6311a2edb2dedc71fb7ebf2d8f7b Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sat, 20 Feb 2016 23:32:01 +0000 Subject: [PATCH] Fix streaming responses (e.g. staticfiles.serve) --- channels/handler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/channels/handler.py b/channels/handler.py index 80faec1..e41007e 100644 --- a/channels/handler.py +++ b/channels/handler.py @@ -242,8 +242,10 @@ class AsgiHandler(base.BaseHandler): # Streaming responses need to be pinned to their iterator if response.streaming: for part in response.streaming_content: - for chunk in cls.chunk_bytes(part): + for chunk, more in cls.chunk_bytes(part): 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 yield message message = {}