diff --git a/starlette/responses.py b/starlette/responses.py index 98c8caf1b..2d4716033 100644 --- a/starlette/responses.py +++ b/starlette/responses.py @@ -250,7 +250,10 @@ async def stream_response(self, send: Send) -> None: async for chunk in self.body_iterator: if not isinstance(chunk, bytes): chunk = chunk.encode(self.charset) - await send({"type": "http.response.body", "body": chunk, "more_body": True}) + if chunk: + await send( + {"type": "http.response.body", "body": chunk, "more_body": True} + ) await send({"type": "http.response.body", "body": b"", "more_body": False})