Revert "Avoid empty body failure on HEAD requests"

This reverts commit 5e8dfb9065.

Change-Id: Ia82e11b65c0d175f2d3b517e43176213eb1a4ae0
This commit is contained in:
Thanh Ha 2018-08-24 13:11:30 -04:00
parent 437d5de4e9
commit f68b2fb9d6
No known key found for this signature in database
GPG Key ID: B0CB27E00DA095AA
1 changed files with 7 additions and 8 deletions

View File

@ -531,14 +531,13 @@ class Jenkins(object):
response.raise_for_status()
headers = response.headers
if response.request.method != 'HEAD':
if (headers.get('content-length') is None and
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)
if (headers.get('content-length') is None and
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)
# Response objects will automatically return unicode encoded
# when accessing .text property