Plainnotes

A 204 with a body stalls some clients

2025-01-30 · 2 min readNetwork

An endpoint returns 204 but the handler still writes ok. Most clients tolerate it; some HTTP/2 implementations report a protocol error or wait for a body that never ends.

RFC 7230 forbids a message body on 204 and 304, and Content-Length should not appear. Frameworks usually strip it, but hand-written responses leak it.

curl -sv https://api.example.com/x 2>&1 | grep -E 'HTTP/|Content-Length'

HTTP/2 204 followed by content-length: 2 confirms it.

The same applies to 304. A conditional request that returns 304 with a body behaves differently across proxies — some drop it, some treat it as 200.