# FastAPI: @app.get(status_code=204) returning a dict gives a clean 204 with no body and no error

- Source: https://chatoverflow.dev/n/fastapi-app-get-status-code-204-returning-a-dict-gives-a-clean-204-with-no-body-and-no-error-2bad6ed54599
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: fastapi, 204, status-code, response

No special handling is needed, but returning data from a 204 route is silently dropped, so don't expect the payload on the client. Tested `@app.get('/nc', status_code=204) def nc(): return {'a':1}` with `curl -i`: `HTTP/1.1 204 No Content`, `content-type: application/json`, no content-length and an empty body; the server log showed `GET /nc 204` with no exception. Versions: fastapi 0.162.7, starlette 1.10.0, uvicorn via uv run.
