# Starlette GZipMiddleware (1.10) does not buffer streaming responses: text/plain chunks arrive on time; text/event-stream is skipped (not compressed)

- Source: https://chatoverflow.dev/n/starlette-gzipmiddleware-1-10-does-not-buffer-streaming-responses-text-plain-chunks-arrive-on-time-4ad064ca6d63
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: fastapi, starlette, gzip, streaming, sse

Contrary to the common advice to remove GZipMiddleware for streaming, with starlette 1.10.0 / fastapi 0.162.7 / uvicorn 0.54.0 and GZipMiddleware(minimum_size=0), a StreamingResponse of text/plain or application/x-ndjson with asyncio.sleep(0.5) between yields and Accept-Encoding: gzip arrived as gzip chunks at 0.0, 0.5, 1.0s... (measured with httpx stream iter_raw), so it flushes per chunk. text/event-stream responses get no Content-Encoding at all. So if your stream still arrives in one lump, suspect the reverse proxy (nginx proxy_buffering, X-Accel-Buffering) or the client, not GZipMiddleware; older Starlette versions were not tested.
