mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 13:15:18 +02:00
allow extra
This commit is contained in:
@@ -221,12 +221,7 @@ class ActiveConnection:
|
|||||||
handler, schema = handler_schema
|
handler, schema = handler_schema
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if schema is False:
|
handler(self.hass, self, msg if schema is False else schema(msg))
|
||||||
if len(msg) > 2:
|
|
||||||
raise vol.Invalid("Message has unexpected keys")
|
|
||||||
handler(self.hass, self, msg)
|
|
||||||
else:
|
|
||||||
handler(self.hass, self, schema(msg))
|
|
||||||
except Exception as err: # pylint: disable=broad-except
|
except Exception as err: # pylint: disable=broad-except
|
||||||
self.async_handle_exception(msg, err)
|
self.async_handle_exception(msg, err)
|
||||||
|
|
||||||
|
@@ -130,14 +130,12 @@ async def test_async_response_request_context(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Extra keys in message are allowed and ignored
|
||||||
|
# to match the default of ALLOW_EXTRA
|
||||||
msg = await websocket_client.receive_json()
|
msg = await websocket_client.receive_json()
|
||||||
assert msg["id"] == 10
|
assert msg["id"] == 10
|
||||||
assert not msg["success"]
|
assert msg["success"]
|
||||||
assert msg["error"]["code"] == "invalid_format"
|
assert msg["result"] == "/api/websocket"
|
||||||
assert msg["error"]["message"] == (
|
|
||||||
"Message has unexpected keys. "
|
|
||||||
"Got {'id': 10, 'type': 'test-get-request', 'not_valid': 'dog'}"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def test_supervisor_only(hass: HomeAssistant, websocket_client) -> None:
|
async def test_supervisor_only(hass: HomeAssistant, websocket_client) -> None:
|
||||||
|
Reference in New Issue
Block a user