1. try...catch aiohttp encode response body to text in test_client

2. add tests static binary file
This commit is contained in:
skytoup
2017-03-23 15:22:00 +08:00
parent 1456b128d2
commit fdbf452ced
3 changed files with 5 additions and 2 deletions

View File

@@ -22,7 +22,10 @@ class SanicTestClient:
cookies=cookies, connector=conn) as session:
async with getattr(
session, method.lower())(url, *args, **kwargs) as response:
response.text = await response.text()
try:
response.text = await response.text()
except UnicodeDecodeError as e:
response.text = None
response.body = await response.read()
return response