Skip to content

Commit f0ee571

Browse files
committed
Integrating changes from PR#88 and PR#90
1 parent 8099166 commit f0ee571

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

intercom/request.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ def send_request_to_path(cls, method, url, auth, params=None):
4242
@classmethod
4343
def parse_body(cls, resp):
4444
try:
45+
# return early for empty responses (issue-72)
46+
if not resp.content or not resp.content.strip():
47+
return
4548
# use supplied encoding to decode the response content
4649
decoded_body = resp.content.decode(
4750
resp.encoding or resp.apparent_encoding
4851
)
49-
if not decoded_body: # return early for empty responses (issue-72)
50-
return
5152
body = json.loads(decoded_body)
5253
if body.get('type') == 'error.list':
5354
cls.raise_application_errors_on_failure(body, resp.status_code)

0 commit comments

Comments
 (0)