1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 09:13:23 +00:00

make it work with gzipped data

This commit is contained in:
Hernan Ezequiel Di Giorgi
2020-04-27 20:39:05 -03:00
committed by Kevin McCarthy
parent b8024de1b8
commit 79d26ebb43
2 changed files with 18 additions and 2 deletions

View File

@@ -139,3 +139,15 @@ def test_redirect(tmpdir, do_request, yml):
assert {k: v for k, v in cassette_response.request.headers.items()} == {
k: v for k, v in response.request.headers.items()
}
def test_work_with_gzipped_data(tmpdir, do_request, yml):
with vcr.use_cassette(yml):
response = do_request()("GET", "https://httpbin.org/gzip")
with vcr.use_cassette(yml) as cassette:
cassette_response = do_request()("GET", "https://httpbin.org/gzip")
assert "gzip" in cassette_response.json()["headers"]["Accept-Encoding"]
assert cassette_response.read()
assert cassette.play_count == 1