Fix getting header in redirect processing
The code for processing an HTTP redirect included an incorrect method of getting the Location header from an HTTPResponse. It needs to use the getheader() method on the response, instead. This patch fixes that and includes a unit test that covers this code path. Change-Id: I0952fabad581b020dee07bdc4007b55b47c906aa Closes-Bug: #1231524
This commit is contained in:
@@ -233,7 +233,8 @@ class HTTPClient(object):
|
||||
raise exc.from_response(resp, body_str)
|
||||
elif resp.status in (301, 302, 305):
|
||||
# Redirected. Reissue the request to the new location.
|
||||
return self._http_request(resp['location'], method, **kwargs)
|
||||
return self._http_request(resp.getheader('location', None), method,
|
||||
**kwargs)
|
||||
elif resp.status == 300:
|
||||
raise exc.from_response(resp)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user