Skip to content

Commit

Permalink
Fix improper usage of body attribute on web.Response. Should be text …
Browse files Browse the repository at this point in the history
…since we arent sending bytes (#23857)
  • Loading branch information
robbiet480 authored and pvizeli committed May 14, 2019
1 parent 128ce58 commit 6f9860b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/geofency/__init__.py
Expand Up @@ -73,7 +73,7 @@ async def handle_webhook(hass, webhook_id, request):
data = WEBHOOK_SCHEMA(dict(await request.post()))
except vol.MultipleInvalid as error:
return web.Response(
body=error.error_message,
text=error.error_message,
status=HTTP_UNPROCESSABLE_ENTITY
)

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/locative/__init__.py
Expand Up @@ -58,7 +58,7 @@ async def handle_webhook(hass, webhook_id, request):
data = WEBHOOK_SCHEMA(dict(await request.post()))
except vol.MultipleInvalid as error:
return web.Response(
body=error.error_message,
text=error.error_message,
status=HTTP_UNPROCESSABLE_ENTITY
)

Expand All @@ -76,7 +76,7 @@ async def handle_webhook(hass, webhook_id, request):
location_name
)
return web.Response(
body='Setting location to {}'.format(location_name),
text='Setting location to {}'.format(location_name),
status=HTTP_OK
)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mobile_app/helpers.py
Expand Up @@ -81,7 +81,7 @@ def registration_context(registration: Dict) -> Context:

def empty_okay_response(headers: Dict = None, status: int = 200) -> Response:
"""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)


Expand Down

0 comments on commit 6f9860b

Please sign in to comment.