Skip to content

Httpx support#25

Open
IlyaSukhanov wants to merge 2 commits intoofw:masterfrom
IlyaSukhanov:httpx_support
Open

Httpx support#25
IlyaSukhanov wants to merge 2 commits intoofw:masterfrom
IlyaSukhanov:httpx_support

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!

@ofw
Copy link
Owner

ofw commented May 25, 2025

Hi! If you think that this change is still relevant please rebase it onto the main branch.

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