Leave JSON encoding to HTTPX#87
Merged
volodymyrZotov merged 1 commit into1Password:mainfrom Jan 5, 2024
Merged
Conversation
9744a13 to
ea6d36b
Compare
Contributor
|
Hi, @mjpieters. I'm sorry for not getting back to you sooner. |
This ensures that the library also includes any content-type headers, and avoids a deprecation warning (`Use 'content=<...>' to upload raw bytes/text content.`) from HTTPX.
ea6d36b to
dc5e390
Compare
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #87 +/- ##
==========================================
- Coverage 76.89% 76.88% -0.02%
==========================================
Files 27 27
Lines 1909 1908 -1
==========================================
- Hits 1468 1467 -1
Misses 441 441 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
volodymyrZotov
approved these changes
Jan 5, 2024
Merged
2 tasks
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.
HTTPX accepts JSON-encodable objects directly, there is no need for this
project to 'manually' encode the data to JSON.
By passing the body object directly to HTTPX, the library can then also handle
the appropriate client headers (Content-Type specifically).
Finally, this also neatly addresses the deprecation warning that HTTPX emits
whithout this change:
Use 'content=<...>' to upload raw bytes/text content..The latter could also be avoided by using
content=serialized_bodyinstead ofdata=serialized_body.