-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Refactor the way how Payload headers are handled #3479
Refactor the way how Payload headers are handled #3479
Conversation
Please fix flake8 |
4548688
to
ba5bf63
Compare
Codecov Report
@@ Coverage Diff @@
## master #3479 +/- ##
==========================================
+ Coverage 97.91% 97.95% +0.04%
==========================================
Files 44 44
Lines 8567 8553 -14
Branches 1383 1377 -6
==========================================
- Hits 8388 8378 -10
+ Misses 74 71 -3
+ Partials 105 104 -1
Continue to review full report at Codecov.
|
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.
Would you add a test or two? :)
Yes, I'm trying to do this around the day, but getting distraction by various things. Once finish with them will remove WIP status. Stay tuned! |
73194ac
to
0f71731
Compare
@asvetlov Ok, it's ready for review. |
66ccd6e
to
74ad55e
Compare
Rebased with conflict fix. Also noticed that Travis CI and AppVeyor has different opinion about |
This change actually solves three separated, but heavy coupled issues: 1. `Payload.content_type` may conflict with `Payload.headers[CONTENT_TYPE]`. While in the end priority goes to the former one, it seems quite strange that Payload object may have dual state about what content type it contains. 2.IOPayload respects Content-Disposition which comes with headers. 3. ClientRequest.skip_autoheaders now filters Payload.headers as well. This issue was eventually found due to refactoring: Payload object may setup some autoheaders, but those will bypass skip logic.
On Linux it detects py-file as `text/x-python`, but on Windows CI just as `text/plain`.
* Refactor the way how Payload headers are handled This change actually solves three separated, but heavy coupled issues: 1. `Payload.content_type` may conflict with `Payload.headers[CONTENT_TYPE]`. While in the end priority goes to the former one, it seems quite strange that Payload object may have dual state about what content type it contains. 2.IOPayload respects Content-Disposition which comes with headers. 3. ClientRequest.skip_autoheaders now filters Payload.headers as well. This issue was eventually found due to refactoring: Payload object may setup some autoheaders, but those will bypass skip logic. * Update change notes * Set Content-Type explicitly to avoid guessing issues On Linux it detects py-file as `text/x-python`, but on Windows CI just as `text/plain`.
This change actually solves three separated, but heavy coupled
issues:
Payload.content_type
may conflict withPayload.headers[CONTENT_TYPE]
.While in the end priority goes to the former one, it seems quite strange that
Payload object may have dual state about what content type it contains.
This is part of #3035 issue.
This issue was eventually found due to refactoring: Payload object
may setup some autoheaders, but those will bypass skip logic.