Check for other valid return codes
200, 201 and 202 are valid return codes that will contain a JSON, so we should check for them also.
This commit is contained in:
parent
9bacf8edea
commit
f75d2d6dc2
@ -63,7 +63,7 @@ class Controller(object):
|
|||||||
:param element: The element to look for in the JSON body
|
:param element: The element to look for in the JSON body
|
||||||
:param default: The default element to be returned if not found.
|
:param default: The default element to be returned if not found.
|
||||||
"""
|
"""
|
||||||
if response.status_int == 200:
|
if response.status_int in [200, 201, 202]:
|
||||||
return response.json_body.get(element, default)
|
return response.json_body.get(element, default)
|
||||||
else:
|
else:
|
||||||
raise exception_from_response(response)
|
raise exception_from_response(response)
|
||||||
|
Loading…
Reference in New Issue
Block a user