Skip to content

Commit

Permalink
Do not try to parse response to json when response is empty (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
racevedoo authored Mar 20, 2024
1 parent afd6240 commit d8ccf61
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions incognia/base_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def post(self, url: Union[str, bytes], headers: Any = None, data: Any = None,
timeout=self.__timeout,
auth=auth)
response.raise_for_status()
if len(response.content) == 0:
return None
return json.loads(response.content.decode('utf-8')) or None

except requests.HTTPError as e:
Expand Down

0 comments on commit d8ccf61

Please sign in to comment.