1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +00:00

SSDP response decode: replace invalid utf-8 characters (#42681)

* SSDP response decode: replace invalid utf-8 characters

* Add test to validate replaced data

Co-authored-by: Joakim Plate <elupus@ecce.se>
This commit is contained in:
Vladimír Záhradník
2021-01-31 17:59:14 +01:00
committed by GitHub
parent ca43b3a8bb
commit ee55223065
3 changed files with 47 additions and 4 deletions

View File

@@ -245,9 +245,9 @@ class AiohttpClientMockResponse:
"""Return mock response."""
return self.response
async def text(self, encoding="utf-8"):
async def text(self, encoding="utf-8", errors="strict"):
"""Return mock response as a string."""
return self.response.decode(encoding)
return self.response.decode(encoding, errors=errors)
async def json(self, encoding="utf-8", content_type=None):
"""Return mock response as a json."""