Add application/xml as an XML to JSON auto converted mime type… (#32289)
* Resolves issue #32280
This commit is contained in:
1 parent
da959c8f7b
commit
924c313c8a
2 files changed
+37
-1
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user