Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion starlette/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down