Refactor the way how Payload headers are handled#3479
Refactor the way how Payload headers are handled#3479asvetlov merged 3 commits intoaio-libs:masterfrom kxepal:3035-refactor-payload-headers
Conversation
|
Please fix flake8 |
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.
|
asvetlov
left a comment
There was a problem hiding this comment.
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! |
|
@asvetlov Ok, it's ready for review. |
|
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_typemay 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.