Use HTTP_OK constant (#33798)

* Use http ok constant

* Remove incorrect use

* Run isort

* Fix pylint by adding missing imports

* Fix pylint by fixing one import
This commit is contained in:
springstan authored and GitHub committed 2020-04-08 11:47:38 -05:00
1 parent 7383e81609
commit 8d61893c39
79 files changed
+214 -154

No files matched your search

+2 -1
View File
@@ -17,6 +17,7 @@ from homeassistant.const import (
HTTP_BAD_REQUEST,
HTTP_CREATED,
HTTP_NOT_FOUND,
HTTP_OK,
MATCH_ALL,
URL_API,
URL_API_COMPONENTS,
@@ -250,7 +251,7 @@ class APIEntityStateView(HomeAssistantView):
)
# Read the state back for our response
status_code = HTTP_CREATED if is_new_state else 200
status_code = HTTP_CREATED if is_new_state else HTTP_OK
resp = self.json(hass.states.get(entity_id), status_code)
resp.headers.add("Location", f"/api/states/{entity_id}")