mirror of
https://github.com/home-assistant/core.git
synced 2025-07-11 15:27:08 +00:00
Fix improper usage of body attribute on web.Response. Should be text since we arent sending bytes (#23857)
This commit is contained in:
parent
128ce589e1
commit
6f9860b25e
@ -73,7 +73,7 @@ async def handle_webhook(hass, webhook_id, request):
|
|||||||
data = WEBHOOK_SCHEMA(dict(await request.post()))
|
data = WEBHOOK_SCHEMA(dict(await request.post()))
|
||||||
except vol.MultipleInvalid as error:
|
except vol.MultipleInvalid as error:
|
||||||
return web.Response(
|
return web.Response(
|
||||||
body=error.error_message,
|
text=error.error_message,
|
||||||
status=HTTP_UNPROCESSABLE_ENTITY
|
status=HTTP_UNPROCESSABLE_ENTITY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ async def handle_webhook(hass, webhook_id, request):
|
|||||||
data = WEBHOOK_SCHEMA(dict(await request.post()))
|
data = WEBHOOK_SCHEMA(dict(await request.post()))
|
||||||
except vol.MultipleInvalid as error:
|
except vol.MultipleInvalid as error:
|
||||||
return web.Response(
|
return web.Response(
|
||||||
body=error.error_message,
|
text=error.error_message,
|
||||||
status=HTTP_UNPROCESSABLE_ENTITY
|
status=HTTP_UNPROCESSABLE_ENTITY
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ async def handle_webhook(hass, webhook_id, request):
|
|||||||
location_name
|
location_name
|
||||||
)
|
)
|
||||||
return web.Response(
|
return web.Response(
|
||||||
body='Setting location to {}'.format(location_name),
|
text='Setting location to {}'.format(location_name),
|
||||||
status=HTTP_OK
|
status=HTTP_OK
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ def registration_context(registration: Dict) -> Context:
|
|||||||
|
|
||||||
def empty_okay_response(headers: Dict = None, status: int = 200) -> Response:
|
def empty_okay_response(headers: Dict = None, status: int = 200) -> Response:
|
||||||
"""Return a Response with empty JSON object and a 200."""
|
"""Return a Response with empty JSON object and a 200."""
|
||||||
return Response(body='{}', status=status, content_type='application/json',
|
return Response(text='{}', status=status, content_type='application/json',
|
||||||
headers=headers)
|
headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user