Fix cloud webhook body (#20739)
* Bugfix cloud webhooks text response * address comments * Fix lint
This commit is contained in:
1 parent
c812176e94
commit
29b64d56be
5 files changed
+40
-35
No files matched your search
@@ -1,5 +1,4 @@
|
||||
"""Test aiohttp request helper."""
|
||||
from aiohttp import web
|
||||
|
||||
from homeassistant.util import aiohttp
|
||||
|
||||
@@ -32,23 +31,3 @@ async def test_request_post_query():
|
||||
assert request.query == {
|
||||
'get': 'true'
|
||||
}
|
||||
|
||||
|
||||
def test_serialize_text():
|
||||
"""Test serializing a text response."""
|
||||
response = web.Response(status=201, text='Hello')
|
||||
assert aiohttp.serialize_response(response) == {
|
||||
'status': 201,
|
||||
'body': b'Hello',
|
||||
'headers': {'Content-Type': 'text/plain; charset=utf-8'},
|
||||
}
|
||||
|
||||
|
||||
def test_serialize_json():
|
||||
"""Test serializing a JSON response."""
|
||||
response = web.json_response({"how": "what"})
|
||||
assert aiohttp.serialize_response(response) == {
|
||||
'status': 200,
|
||||
'body': b'{"how": "what"}',
|
||||
'headers': {'Content-Type': 'application/json; charset=utf-8'},
|
||||
}
|
||||
Reference in new issue
Block a user