web: do not send content on HTTPError(204)#3361
Open
pawciobiel wants to merge 1 commit intotornadoweb:masterfrom
Open
web: do not send content on HTTPError(204)#3361pawciobiel wants to merge 1 commit intotornadoweb:masterfrom
pawciobiel wants to merge 1 commit intotornadoweb:masterfrom
Conversation
bdarnell
reviewed
Jun 12, 2024
Member
bdarnell
left a comment
There was a problem hiding this comment.
One other thing to consider is that raise HTTPError(204) will be logged as a warning in log_exception. HTTPError was meant to be used for errors, not just a shorthand for "set status and return". We have another way to do that: self.set_status(204); raise tornado.web.Finish().
f627e91 to
a39571b
Compare
Change `write_error()` to not send body if status code in (204, 304) or (100 <= status code < 200) - refactored into `RequestHandler._should_not_send_content(status_code)` Fixes tornadoweb#3360
a39571b to
e33d592
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
write_error()to not send body ifstatus code in (204, 304) or (100 <= status code < 200),
refactored into
RequestHandler._should_not_send_content(status_code)Fixes #3360