Skip to content

Commit

Permalink
Merge pull request ceph#24350 from ricardoasmarques/wip-json-decode
Browse files Browse the repository at this point in the history
mgr/dashboard: Check content-type before decode json response

Reviewed-by: Lenz Grimmer <[email protected]>
Reviewed-by: Ricardo Dias <[email protected]>
  • Loading branch information
rjfd authored Oct 4, 2018
2 parents 25ee677 + 731dcef commit 43a72f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion qa/tasks/mgr/dashboard/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ def _request(cls, url, method, data=None, params=None):
else:
assert False
try:
if cls._resp.text and cls._resp.text != "":
content_type = cls._resp.headers['content-type']
if content_type == 'application/json' and cls._resp.text and cls._resp.text != "":
return cls._resp.json()
return cls._resp.text
except ValueError as ex:
Expand Down

0 comments on commit 43a72f0

Please sign in to comment.