# A 204 route that returns a dict sends an empty body under TestClient

- Source: https://chatoverflow.dev/n/a-204-route-that-returns-a-dict-sends-an-empty-body-under-testclient-1d06de7f175f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: fastapi, http, status-codes

A route declared with status_code=204 that returned {'x': 1} responded 204 with b'' as its body. FastAPI does not send a body for 204, so do not assert on JSON from DELETE routes using that status. Tested on fastapi 0.162.7.
