Make ApiClient more tolerant of Content-Types
This commit is contained in:
parent
8b1410aed5
commit
1eae2dcc3c
@ -40,7 +40,7 @@ class ApiClient(object):
|
|||||||
return self.adapt_response(response)
|
return self.adapt_response(response)
|
||||||
|
|
||||||
def adapt_response(self, response):
|
def adapt_response(self, response):
|
||||||
if response.headers['Content-Type'] == 'application/json':
|
if 'application/json' in response.headers['Content-Type']:
|
||||||
json = loads(response.body)
|
json = loads(response.body)
|
||||||
setattr(response, 'json', json)
|
setattr(response, 'json', json)
|
||||||
setattr(response, 'ok', 200 <= response.code < 300)
|
setattr(response, 'ok', 200 <= response.code < 300)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user