vcrpy
vcrpy copied to clipboard
httpx cassettes not compatible with vcr format
trafficstars
httpx not worked from box if we create simple test
import pytest
import httpx
@pytest.mark.vcr()
def test_iana():
response = httpx.get('http://www.iana.org/domains/reserved')
assert b'Example domains' in response.content
and run it
pytest --record-mode=once tests/test_vcr.py
we have error with cassette file format
> new_body = decompress_body(response["body"]["string"], encoding)
E KeyError: 'body'
vcr/filters.py:158: KeyError
because cassette file format for httpx uses content parameter, but all other stubs use body.string parameters to save and filter result
and if we will use existing cassettes with httpx it won`t work for the same reason
#591
Hey,
interesting that this issue is open for so long. We are replacing requests by httpx in more and more projects. So it would be great to get this issue fixed :smiley:
Thanks a lot for this great project :+1: