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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user