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

Update aiohttp_stub to work with binary content

This commit is contained in:
Allisson Azevedo
2017-06-22 15:12:58 -03:00
parent 47ccddafee
commit c55d976277
3 changed files with 34 additions and 17 deletions

View File

@@ -21,6 +21,10 @@ class MockClientResponse(ClientResponse):
def text(self, encoding='utf-8'):
return self.content.decode(encoding)
@asyncio.coroutine
def read(self):
return self.content
@asyncio.coroutine
def release(self):
pass
@@ -71,7 +75,7 @@ def vcr_request(cassette, real_request):
'message': response.reason,
},
'headers': dict(response.headers),
'body': {'string': (yield from response.text())}, # NOQA: E999
'body': {'string': (yield from response.read())}, # NOQA: E999
'url': response.url,
}
cassette.append(vcr_request, vcr_response)