From bbab27ed1bb7d066382896da93d0265b1be85e2e Mon Sep 17 00:00:00 2001 From: Luiz Menezes Date: Thu, 4 Jul 2019 21:52:08 -0300 Subject: [PATCH] Use primitive types when recording cassettes using aiohttp stub (#454) --- tests/integration/test_aiohttp.py | 2 ++ vcr/stubs/aiohttp_stubs/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_aiohttp.py b/tests/integration/test_aiohttp.py index bbb0913..8f3b743 100644 --- a/tests/integration/test_aiohttp.py +++ b/tests/integration/test_aiohttp.py @@ -56,6 +56,8 @@ def test_headers(tmpdir, scheme): cassette_response, _ = get(url) assert cassette_response.headers == response.headers assert cassette.play_count == 1 + assert 'istr' not in cassette.data[0] + assert 'yarl.URL' not in cassette.data[0] def test_text(tmpdir, scheme): diff --git a/vcr/stubs/aiohttp_stubs/__init__.py b/vcr/stubs/aiohttp_stubs/__init__.py index 237ddea..6de1c17 100644 --- a/vcr/stubs/aiohttp_stubs/__init__.py +++ b/vcr/stubs/aiohttp_stubs/__init__.py @@ -98,9 +98,9 @@ def vcr_request(cassette, real_request): 'code': response.status, 'message': response.reason, }, - 'headers': dict(response.headers), + 'headers': {str(key): value for key, value in response.headers.items()}, 'body': {'string': (await response.read())}, # NOQA: E999 - 'url': response.url, + 'url': str(response.url), } cassette.append(vcr_request, vcr_response)