Merge "Update to _response_handler"

This commit is contained in:
Zuul 2018-05-19 21:42:19 +00:00 committed by Gerrit Code Review
commit 892cd41f94
2 changed files with 4 additions and 2 deletions

View File

@ -509,13 +509,14 @@ class Jenkins(object):
headers = response.headers
if (headers.get('content-length') is None and
headers.get('transfer-encoding') is None):
headers.get('transfer-encoding') is None and
(response.content is None or len(response.content) <= 0)):
# response body should only exist if one of these is provided
raise EmptyResponseException(
"Error communicating with server[%s]: "
"empty response" % self.server)
# Reponse objects will automatically return unicode encoded
# Response objects will automatically return unicode encoded
# when accessing .text property
return response

View File

@ -102,5 +102,6 @@ def build_response_mock(status_code, json_body=None, headers=None, **kwargs):
# for some reason, wraps cannot handle attributes which are dicts
# and accessed by key
response.headers = real_response.headers
response.content = text
return response