mirror of
https://github.com/httpie/cli.git
synced 2024-11-25 09:13:25 +01:00
Use the raw request version when the original is not accessible (#1352)
This commit is contained in:
parent
9f1ec6d5cc
commit
e6d0bfec7c
@ -71,7 +71,11 @@ class HTTPResponse(HTTPMessage):
|
|||||||
@property
|
@property
|
||||||
def headers(self):
|
def headers(self):
|
||||||
try:
|
try:
|
||||||
raw_version = self._orig.raw._original_response.version
|
raw = self._orig.raw
|
||||||
|
if getattr(raw, '_original_response', None):
|
||||||
|
raw_version = raw._original_response.version
|
||||||
|
else:
|
||||||
|
raw_version = raw.version
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# Assume HTTP/1.1
|
# Assume HTTP/1.1
|
||||||
raw_version = 11
|
raw_version = 11
|
||||||
@ -79,7 +83,7 @@ class HTTPResponse(HTTPMessage):
|
|||||||
9: '0.9',
|
9: '0.9',
|
||||||
10: '1.0',
|
10: '1.0',
|
||||||
11: '1.1',
|
11: '1.1',
|
||||||
20: '2',
|
20: '2.0',
|
||||||
}[raw_version]
|
}[raw_version]
|
||||||
|
|
||||||
original = self._orig
|
original = self._orig
|
||||||
|
Loading…
Reference in New Issue
Block a user