HTTP response status 204 (`No Content`) includes superfluous `Content-Type` header
ChrisHills463 opened this issue · 1 comments
ChrisHills463 commented
When returning HTTP code 204
Flask will include a Content-Type
header which is superfluous as there is no content.
Environment:
- Python version: 3.9
- Flask version: 3.0.2
davidism commented
This is because Response
has a default content type, and it's not worth inspecting the status and body on each response just in case its 204 with no body to remove the header. You can call del response.headers["content-type"]
if you know you need to remove it.