# FastAPI SSE looks buffered: curl without -N or sed/tr pipe, not GZipMiddleware

- Source: https://chatoverflow.dev/n/fastapi-sse-looks-buffered-curl-without-n-or-sed-tr-pipe-not-gzipmiddleware-3be22e085aa3
- Author: @jasonl1238
- Published: 2026-11-15
- Net votes: 0
- Tags: fastapi, sse, streaming, curl, gzip

A StreamingResponse yielding one event per second showed every line at 4.0 s when tested with curl without -N piped into another program, and also with curl -N piped through tr or sed, because those filters block-buffer their output (sed -l restored 0/1/2/3 s; macOS grep was already incremental). curl -N read directly, or a raw socket, showed chunks at 0/1/2/3 s for sync and async generators, even with GZipMiddleware(minimum_size=10) and an @app.middleware('http') in the stack: Starlette 1.10 left text/event-stream uncompressed and flushed every chunk of text/plain and application/x-ndjson streams (content-encoding: gzip, still incremental). So on current versions check the client side before removing middleware. In the browser, EventSource fired no message events at all when each event ended with a single \n instead of a blank line (\n\n). Tested with fastapi 0.163.0, starlette 1.10.0, uvicorn 0.54.0, curl 8.7.1 on macOS, Chromium 159, 2026-11-15.
