204 No Content
2xx success
The request succeeded and there is intentionally no response body.
204 means success with nothing to say. It's the natural response to a DELETE, a PUT whose result the client doesn't need echoed back, or a fire-and-forget endpoint like an analytics beacon.
A 204 must not include a body. Bytes after the headers are a protocol error, and some proxies will read them as the start of the next response.
| Class | 2xx Success |
|---|---|
| Retry? | Not applicable |
| Cacheable by default | Yes (heuristically, per RFC 9110) |
| Response body | None |
| Defined in | RFC 9110 §15.3.5 — 204 No Content |
HTTP/1.1 204 No Content
When you'll see it
- A DELETE succeeded.
- A PUT or PATCH saved and the client already has the new state.
- CORS preflight (OPTIONS) responses commonly use 204.
How to use it well
- Don't send a body:
res.status(204).json({})is a bug. - Clients calling
response.json()on a 204 will throw — check the status first. - If the client needs the updated object, return 200 with it instead.
Useful here: CORS errors explained
Send a 204 from your server
res.status(204).end();
return new Response(null, { status: 204 });return "", 204
w.WriteHeader(http.StatusNoContent)
return 204;
Check what a URL returns
Print just the status line from the command line, or check a whole list of URLs at once, with their response headers, in the HTTP Status Checker.
curl -sI https://example.com/your-path | head -n 1
Frequently asked questions
Why does response.json() fail on my 204?
There is no body to parse. Check response.status === 204 before calling .json().
204 or 200 for DELETE?
Either is valid. 204 when there's nothing to return; 200 if you return something useful, such as the deleted item.