Webhook component - pass headers to webhook handler (#17091)

* Pass headers to webhook handler

* Refactors webhook component to post Request object instead of data

* Update webhook tests

* Cleanup webhook test and fix a bug in ifttt

* Address code review comments
This commit is contained in:
Georgi Kirichkov authored and Paulus Schoutsen committed 2018-10-04 15:54:51 +02:00
1 parent 0cfbb9ce91
commit b92b24e8a4
3 files changed
+12 -16

No files matched your search

+3 -5
View File
@@ -63,7 +63,7 @@ async def test_posting_webhook_json(hass, mock_client):
async def handle(*args):
"""Handle webhook."""
hooks.append(args)
hooks.append((args[0], args[1], await args[2].text()))
hass.components.webhook.async_register(webhook_id, handle)
@@ -74,9 +74,7 @@ async def test_posting_webhook_json(hass, mock_client):
assert len(hooks) == 1
assert hooks[0][0] is hass
assert hooks[0][1] == webhook_id
assert hooks[0][2] == {
'data': True
}
assert hooks[0][2] == '{"data": true}'
async def test_posting_webhook_no_data(hass, mock_client):
@@ -95,4 +93,4 @@ async def test_posting_webhook_no_data(hass, mock_client):
assert len(hooks) == 1
assert hooks[0][0] is hass
assert hooks[0][1] == webhook_id
assert hooks[0][2] == {}
assert await hooks[0][2].text() == ''