diff options
author | SVN-Git Migration <python-modules-team@lists.alioth.debian.org> | 2015-10-08 13:41:22 -0700 |
---|---|---|
committer | SVN-Git Migration <python-modules-team@lists.alioth.debian.org> | 2015-10-08 13:41:22 -0700 |
commit | 40337989ba5056432c9f2af3c42267e5ee9e3e18 (patch) | |
tree | 25a680529c68fcdd7886b4b064845c3e371e167e /requests/packages/urllib3/response.py | |
parent | e75853fc04102c7f72f2e955b63f9692c472f64a (diff) | |
download | python-requests-40337989ba5056432c9f2af3c42267e5ee9e3e18.tar python-requests-40337989ba5056432c9f2af3c42267e5ee9e3e18.tar.gz |
Imported Upstream version 0.11.1
Diffstat (limited to 'requests/packages/urllib3/response.py')
-rw-r--r-- | requests/packages/urllib3/response.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/requests/packages/urllib3/response.py b/requests/packages/urllib3/response.py index 4dd431e..5fab824 100644 --- a/requests/packages/urllib3/response.py +++ b/requests/packages/urllib3/response.py @@ -171,11 +171,22 @@ class HTTPResponse(object): with ``original_response=r``. """ + # Normalize headers between different versions of Python + headers = {} + for k, v in r.getheaders(): + # Python 3: Header keys are returned capitalised + k = k.lower() + + has_value = headers.get(k) + if has_value: # Python 3: Repeating header keys are unmerged. + v = ', '.join([has_value, v]) + + headers[k] = v + # HTTPResponse objects in Python 3 don't have a .strict attribute strict = getattr(r, 'strict', 0) return ResponseCls(body=r, - # In Python 3, the header keys are returned capitalised - headers=dict((k.lower(), v) for k,v in r.getheaders()), + headers=headers, status=r.status, version=r.version, reason=r.reason, |