[BUG] null returned for 204
See original GitHub issueHi,
we’re running Python 3.7.3 with FastAPI 0.27.2 and have the following API definition (simplified):
app.post("/url", status_code = HTTP_204_OK)
async def set_data(data: Data) -> None:
await db.set_data(data)
We return a 204 and return nothing in the body but we see that null is returned with a content length of 4. The client expect content-length = 0 for a 204 response. Can this please be fixed?
Thanks, Daniel
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:14 (8 by maintainers)
Top Results From Across the Web
c# - Null response returns a 204
"HTTP 204 NO CONTENT: The server has successfully fulfilled the request and that there is no additional content to send in the response...
Read more >Null API Responses and HTTP 204 Results in ASP.NET Core
ASP.NET Core 3.x has a behavior that results in API results that return null from the controller action returning a HTTP 204 -...
Read more >Unable to construct a null body Response with status 204
The spec says Response should have null body if its first argument is not given, which means undefined is given.
Read more >#43691 (class-wp-rest-server sends response body ...
Status code 204 should indicate no response body is sent. Previously, a "null" string was sent, which MacOS Safari would try to parse...
Read more >Bug ID: JDK-8211420 com.sun.net.httpserver. ...
HttpServer returns Content-length header for 204 response code ... setExecutor(null); server.start(); } static class MyHandler implements HttpHandler ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To add to @euri10 's point, you can similarly fix this via:
I agree, maybe worth a ping upstream as the current API let you return a 204 with content, which shouldn’t be possible