Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP response status 204 (No Content) includes superfluous Content-Type header #5455

Closed
ChrisHills463 opened this issue Apr 2, 2024 · 1 comment

Comments

@ChrisHills463
Copy link

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
Copy link
Member

davidism commented Apr 2, 2024

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.

@davidism davidism closed this as not planned Won't fix, can't repro, duplicate, stale Apr 2, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants