Skip to content

Commit

Permalink
Handle responses with empty content (gateway-experiments#77)
Browse files Browse the repository at this point in the history
Application submission via the REST API does not return a response
body.  This updates ensures that an empty dictionary is returned
in such cases.

Fixes: gateway-experiments#76
  • Loading branch information
kevin-bates authored and lresende committed Jan 13, 2020
1 parent 2ea5f85 commit 25c29b6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions yarn_api_client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ class Response(object):
:param requests.Response response: Response for call via requests lib
"""
def __init__(self, response):
#: Dictionary with response data
self.data = response.json()
#: Dictionary with response data. Handle cases where content is empty
# to prevent JSON decode issues
if response.content:
self.data = response.json()
else:
self.data = {}


class Uri(object):
Expand Down

0 comments on commit 25c29b6

Please sign in to comment.