Skip to content
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

Httpx support #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Httpx support #25

wants to merge 2 commits into from

Conversation

IlyaSukhanov
Copy link

Add support for httpx

As httpx strives for close compatibility with requests few
changes needed to be made in curlify

  • .lower() on headers (headers in http are case insensitive and httpx / requests use different cases.
  • httpx does not have a .body but contents can be accessed via .read() instead, curlify will now use either or.
  • httpx stores url in as URL object so we stringify it.

Majority of the changes are in tests.

  • all tests are mocked out so there is no hitting of external services
  • payload tests are more relaxed. Testing for approximate existence of flags rather than exact string match. This is a workaround to deal with various discordant optional http headers.

Unrelated changes include a makefile to aide with testing and update of testing requirements.

As httpx strives for close compatibility with requests few
changes needed to be made in curlify:
* .lower() on headers (headers in http are case insensitive
  and httpx / requests use different cases.
* httpx does not have a .body but contents can be accessed
  via .read() instead, curlify will now use either or.
* httpx stores url in as URL object so we stringify it.

Majority of the changes are in tests.
* all tests are mocked out so there is no hitting of external
  services
* payload tests are more relaxed. Testing for approximate
  existence of flags rather than exact string match. This is a
  workaround to deal with various discordant optional http
  headers.
@tdonovic
Copy link

tdonovic commented Mar 3, 2022

I know this library has a long time since anything has been merged, but I would love to use this change!

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.

None yet

2 participants