204 No Content

Success with deliberately no response body — the correct answer for DELETE, many PUT/PATCH updates, and preflight-ish endpoints. The defining rule: a 204 response must not contain a body, and clients must not try to parse one.

What usually causes it

  • Successful DELETE or update where returning the entity is pointless
  • Beacon/analytics endpoints acknowledging a fire-and-forget POST

How to debug and fix it

  1. If your client throws 'unexpected end of JSON input' after a delete, it is calling response.json() on a 204 — check status before parsing.
  2. If a 204 arrives with a body anyway, the server is violating the spec; some proxies will truncate or reject it.
  3. Prefer 204 over 200-with-empty-body: it is explicit, slightly cheaper, and unambiguous for caches.

Easily confused with