mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Use the json load helper in a few more incoming web requests (#90194)
* Use the json load helper in a few more incoming web requests * drop hassio change as there is no coverage there * Remove everything except emulated_hue since its has its own site/web
This commit is contained in:
parent
72b09bfee7
commit
8e07b71644
@ -64,6 +64,7 @@ from homeassistant.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.core import State
|
from homeassistant.core import State
|
||||||
from homeassistant.helpers.event import async_track_state_change_event
|
from homeassistant.helpers.event import async_track_state_change_event
|
||||||
|
from homeassistant.util.json import json_loads
|
||||||
from homeassistant.util.network import is_local
|
from homeassistant.util.network import is_local
|
||||||
|
|
||||||
from .config import Config
|
from .config import Config
|
||||||
@ -138,7 +139,7 @@ class HueUsernameView(HomeAssistantView):
|
|||||||
return self.json_message("Only local IPs allowed", HTTPStatus.UNAUTHORIZED)
|
return self.json_message("Only local IPs allowed", HTTPStatus.UNAUTHORIZED)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = await request.json()
|
data = await request.json(loads=json_loads)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return self.json_message("Invalid JSON", HTTPStatus.BAD_REQUEST)
|
return self.json_message("Invalid JSON", HTTPStatus.BAD_REQUEST)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user