-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Skip auto-generation of Content-Type header. #507
Skip auto-generation of Content-Type header. #507
Conversation
Content-Type header automatic generation did not honor the documented `skip_auto_headers` param. With this patch we correctly skip generation of this header while documenting that it is not possible to do so for the `Content-Length` header. See Issue aio-libs#379 for details.
@@ -290,7 +291,8 @@ def update_body_from_data(self, data): | |||
if not self.chunked and isinstance(data, io.BytesIO): | |||
# Not chunking if content-length can be determined | |||
size = len(data.getbuffer()) | |||
self.headers[hdrs.CONTENT_LENGTH] = str(size) | |||
if hdrs.CONTENT_LENGTH not in skip_auto_headers: | |||
self.headers[hdrs.CONTENT_LENGTH] = str(size) |
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.
This one looks wrong. If we don't set content length here, we should fallback to chunked = True mode. Otherwise we'll violate the spec.
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.
whoa Yep you're right, I'll fix this right away
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.
ok fixed
Even when the caller asked to skip it!
also fixes #457 |
…ader Skip auto-generation of Content-Type header.
Merged. Thanks. |
Content-Type header automatic generation did not honor
the documented
skip_auto_headers
param.With this patch we correctly skip generation of this header
while documenting that it is not possible to do so for the
Content-Length
header.See Issue #379 for details.