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:
Alvaro Lopez Garcia 2015-04-10 10:05:03 +02:00
parent 9bacf8edea
commit f75d2d6dc2

View File

@ -63,7 +63,7 @@ class Controller(object):
:param element: The element to look for in the JSON body
: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)
else:
raise exception_from_response(response)