curlify icon indicating copy to clipboard operation
curlify copied to clipboard

Httpx support

Open IlyaSukhanov opened this issue 5 years ago • 2 comments

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.

IlyaSukhanov avatar May 25 '20 15:05 IlyaSukhanov

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

tdonovic avatar Mar 03 '22 12:03 tdonovic