-
-
Notifications
You must be signed in to change notification settings - Fork 933
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
Don't set headers for responses with 1xx, 204 and 304 status code #1397
Conversation
Looking at this change and prompted by #1395 (comment), what happens if you still pass a body in, i.e. My skimming of the relevant ASGI 3 spec suggests the ASGI server may add Perhaps the implicit expectation is that the ASGI server will use "may" here and recognise response codes for which I apologise if I'm asking a question with an obvious/known answer already. I'm new to the ASGI ecosystem, and may be misunderstanding the division of responsibility or otherwise. |
Probably you've just got yourself an RFC-invalid response. We could potentially guard against those kinds of cases, and I'd be happy for us to discuss that as a follow-up issue if anyone's sufficiently motivated to do so. The most important thing for this pull request tho, is to make sure we're doing the right thing for the sensible cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, yup.
Observations prompted by the PR...
I think our naming of populate_content_length
/ populate_content_type
in the init_headers
method isn't really ideal at this point, and I'd also consider us switching it to a plain function rather than a stateful method (because I think it's easier to understand the behaviour then).
Not something to address here, but perhaps worth consideration.
Closes #1178 (?)
Closes #1282