When there is no error body return the HTTP reason
Return the response reason when there is no message body to return. DocImpact Change-Id: Ia60da4f04b059a13fcbe0059bb42fd77f272d8aa Closes-Bug: 1248773
This commit is contained in:
@@ -172,4 +172,5 @@ def from_response(response, body):
|
|||||||
return cls(code=response.status_code, message=message, details=details,
|
return cls(code=response.status_code, message=message, details=details,
|
||||||
request_id=request_id)
|
request_id=request_id)
|
||||||
else:
|
else:
|
||||||
return cls(code=response.status_code, request_id=request_id)
|
return cls(code=response.status_code, request_id=request_id,
|
||||||
|
message=response.reason)
|
||||||
|
@@ -46,6 +46,7 @@ class TestResponse(requests.Response):
|
|||||||
if isinstance(data, dict):
|
if isinstance(data, dict):
|
||||||
self.status_code = data.get('status_code', None)
|
self.status_code = data.get('status_code', None)
|
||||||
self.headers = data.get('headers', None)
|
self.headers = data.get('headers', None)
|
||||||
|
self.reason = data.get('reason', '')
|
||||||
# Fake the text attribute to streamline Response creation
|
# Fake the text attribute to streamline Response creation
|
||||||
self._text = data.get('text', None)
|
self._text = data.get('text', None)
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user