Avoid empty body failure on HEAD requests

HTTP specification states clearly that HEAD requests
should have no body, so we should not fail on these.

Change-Id: I9d2418f26c26b2a40f6bafaf86ed6640fbf83b0c
This commit is contained in:
Sorin Sbarnea 2018-08-07 17:48:29 +01:00
parent 4150a83d45
commit 5e8dfb9065
1 changed files with 8 additions and 7 deletions

View File

@ -531,6 +531,7 @@ 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)):