mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Use text= instead of body= for creating web responses (#20879)
This commit is contained in:
parent
81cad8cd52
commit
c66ec87b69
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user