Skip to content

Commit

Permalink
aiohttp response binary format support
Browse files Browse the repository at this point in the history
  • Loading branch information
p1c2u committed Sep 20, 2023
1 parent cbbe084 commit 0f836b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openapi_core/contrib/aiohttp/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ def data(self) -> str:
if self.response.body is None:
return ""
if isinstance(self.response.body, bytes):
return self.response.body.decode("utf-8")
try:
return self.response.body.decode("utf-8")
except UnicodeDecodeError:
return self.response.body
assert isinstance(self.response.body, str)
return self.response.body

Expand Down

0 comments on commit 0f836b9

Please sign in to comment.