Skip to content

Commit

Permalink
treat empty response as null
Browse files Browse the repository at this point in the history
  • Loading branch information
siku2 committed Sep 18, 2023
1 parent 7c26886 commit abc2b67
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions custom_components/vzug/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,11 @@ async def once() -> Any:
try:
data = resp.json()
except ValueError:
_LOGGER.debug("invalid json payload: %s", resp.text)
raise
if resp.content:
_LOGGER.debug("invalid json payload: %s", resp.content)
raise
# we got an empty response, we just treat this as 'None'
data = None

_LOGGER.debug("data: %s", data)
if expected_type is list and data is None:
Expand Down

0 comments on commit abc2b67

Please sign in to comment.