From 33dcb071dab25dd93ce7bcfae70315ace5af4702 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 8 Feb 2019 23:10:04 -0800 Subject: [PATCH] Use text= instead of body= for creating web responses (#20879) --- homeassistant/components/geofency/__init__.py | 2 +- homeassistant/components/gpslogger/__init__.py | 4 ++-- homeassistant/components/locative/__init__.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/geofency/__init__.py b/homeassistant/components/geofency/__init__.py index f58580b83c7..f265bd3492a 100644 --- a/homeassistant/components/geofency/__init__.py +++ b/homeassistant/components/geofency/__init__.py @@ -123,7 +123,7 @@ def _set_location(hass, data, location_name): ) return web.Response( - body="Setting location for {}".format(device), + text="Setting location for {}".format(device), status=HTTP_OK ) diff --git a/homeassistant/components/gpslogger/__init__.py b/homeassistant/components/gpslogger/__init__.py index d4150900223..39d795dcd25 100644 --- a/homeassistant/components/gpslogger/__init__.py +++ b/homeassistant/components/gpslogger/__init__.py @@ -66,7 +66,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 ) @@ -91,7 +91,7 @@ async def handle_webhook(hass, webhook_id, request): ) return web.Response( - body='Setting location for {}'.format(device), + text='Setting location for {}'.format(device), status=HTTP_OK ) diff --git a/homeassistant/components/locative/__init__.py b/homeassistant/components/locative/__init__.py index 1f7f9c3a686..5a27fbaec63 100644 --- a/homeassistant/components/locative/__init__.py +++ b/homeassistant/components/locative/__init__.py @@ -101,7 +101,7 @@ async def handle_webhook(hass, webhook_id, request): location_name ) return web.Response( - body='Setting location to not home', + text='Setting location to not home', status=HTTP_OK ) @@ -110,7 +110,7 @@ async def handle_webhook(hass, webhook_id, request): # before the previous zone was exited. The enter message will # be sent first, then the exit message will be sent second. return web.Response( - body='Ignoring exit from {} (already in {})'.format( + text='Ignoring exit from {} (already in {})'.format( location_name, current_state ), status=HTTP_OK @@ -120,14 +120,14 @@ async def handle_webhook(hass, webhook_id, request): # In the app, a test message can be sent. Just return something to # the user to let them know that it works. return web.Response( - body='Received test message.', + text='Received test message.', status=HTTP_OK ) _LOGGER.error('Received unidentified message from Locative: %s', direction) return web.Response( - body='Received unidentified message: {}'.format(direction), + text='Received unidentified message: {}'.format(direction), status=HTTP_UNPROCESSABLE_ENTITY )