Skip to content

Bugfix cloud webhooks text response#20737

Closed
pvizeli wants to merge 3 commits intodevfrom
fix-cloud-webhook-body
Closed

Bugfix cloud webhooks text response#20737
pvizeli wants to merge 3 commits intodevfrom
fix-cloud-webhook-body

Conversation

@pvizeli
Copy link
Copy Markdown
Member

@pvizeli pvizeli commented Feb 4, 2019

Description:

I change it to text because we only support text as response and aioHttp perform the correct charset that not need to be utf-8 like we set now static.

Fix:

Error handling message
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/cloud/iot.py", line 237, in _handle_connection
    hass, self.cloud, msg['handler'], msg['payload'])
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/cloud/iot.py", line 293, in async_handle_message
    return (yield from handler(hass, cloud, payload))
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/cloud/iot.py", line 366, in async_handle_webhook
    body = body.decode('utf-8')
AttributeError: 'StringPayload' object has no attribute 'decode'

@pvizeli pvizeli requested a review from a team as a code owner February 4, 2019 14:01
@ghost ghost assigned pvizeli Feb 4, 2019
@ghost ghost added the in progress label Feb 4, 2019
@pvizeli pvizeli added this to the 0.87.0 milestone Feb 4, 2019
"""Serialize an aiohttp response to a dictionary."""
return {
'status': response.status,
'body': response.body,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a generic helper, we should not change its behavior to make it more shaped for one implementation. If we want that, we should move this function inside the cloud integration.

@pvizeli pvizeli closed this Feb 4, 2019
@pvizeli pvizeli deleted the fix-cloud-webhook-body branch February 4, 2019 15:28
@pvizeli pvizeli mentioned this pull request Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants