Replies: 2 comments 2 replies
-
Werkzeug
If you're commonly sending 204 responses, you can write a helper to produce a response in the exact form you need: def make_204(...):
response = Response(status=204)
del response.headers["content-type"]
...
return response You can also override |
Beta Was this translation helpful? Give feedback.
-
Fair enough. :) Thanks for the discussion and suggestions you provided. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I received a warning form the Python webtest library when responding with a 204 HTTP status code b/c Flask (or Werkzeug, I didn't dig to find where it happens) adds a Content-Type header by default:
('Content-Type', 'text/html; charset=utf-8')
.Led me to a discussion with Claude about what the spec says regarding. It sounds like it's not prohibited but would make sense to not add the header if the status code is 204.
It's a small thing, but should Flask/Werkzeug take the status code into account before adding a content type header?
Beta Was this translation helpful? Give feedback.
All reactions