mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 20:55:10 +02:00
allow extra
This commit is contained in:
@@ -221,12 +221,7 @@ class ActiveConnection:
|
||||
handler, schema = handler_schema
|
||||
|
||||
try:
|
||||
if schema is False:
|
||||
if len(msg) > 2:
|
||||
raise vol.Invalid("Message has unexpected keys")
|
||||
handler(self.hass, self, msg)
|
||||
else:
|
||||
handler(self.hass, self, schema(msg))
|
||||
handler(self.hass, self, msg if schema is False else schema(msg))
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
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()
|
||||
assert msg["id"] == 10
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "invalid_format"
|
||||
assert msg["error"]["message"] == (
|
||||
"Message has unexpected keys. "
|
||||
"Got {'id': 10, 'type': 'test-get-request', 'not_valid': 'dog'}"
|
||||
)
|
||||
assert msg["success"]
|
||||
assert msg["result"] == "/api/websocket"
|
||||
|
||||
|
||||
async def test_supervisor_only(hass: HomeAssistant, websocket_client) -> None:
|
||||
|
Reference in New Issue
Block a user