Add application/xml as an XML to JSON auto converted mime type… (#32289)

* Resolves issue #32280
This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-03-01 23:22:01 -08:00
1 parent da959c8f7b
commit 924c313c8a
2 files changed
+37 -1

No files matched your search

+4 -1
View File
@@ -206,7 +206,10 @@ class RestSensor(Entity):
# If the http request failed, headers will be None
content_type = self.rest.headers.get("content-type")
if content_type and content_type.startswith("text/xml"):
if content_type and (
content_type.startswith("text/xml")
or content_type.startswith("application/xml")
):
try:
value = json.dumps(xmltodict.parse(value))
_LOGGER.debug("JSON converted from XML: %s", value)