Skip to content

Leave JSON encoding to HTTPX#87

Merged
volodymyrZotov merged 1 commit into1Password:mainfrom
mjpieters:use_httpx_for_json
Jan 5, 2024
Merged

Leave JSON encoding to HTTPX#87
volodymyrZotov merged 1 commit into1Password:mainfrom
mjpieters:use_httpx_for_json

Conversation

@mjpieters
Copy link
Copy Markdown
Contributor

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_body instead of
data=serialized_body.

@volodymyrZotov
Copy link
Copy Markdown
Contributor

Hi, @mjpieters. I'm sorry for not getting back to you sooner.
This change looks good! I'm about to merge it. Could you resolve the conflict, please?

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.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 4, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.88%. Comparing base (bf1c6fa) to head (dc5e390).
⚠️ Report is 54 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@volodymyrZotov volodymyrZotov merged commit a741a44 into 1Password:main Jan 5, 2024
@mjpieters mjpieters deleted the use_httpx_for_json branch January 5, 2024 15:43
@github-actions github-actions Bot mentioned this pull request Jan 5, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants