summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBatuhan Taskaya <isidentical@gmail.com>2022-04-14 17:41:12 +0300
committerGitHub <noreply@github.com>2022-04-14 07:41:12 -0700
commite6d0bfec7c0811f3260dfa8455c53d6dbcff76c7 (patch)
tree32e851f9ecabafe3fd4dbd7ce298f57225449738
parent9f1ec6d5cc682360dc181aacfa94255b83080cfc (diff)
Use the raw request version when the original is not accessible (#1352)
-rw-r--r--httpie/models.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/httpie/models.py b/httpie/models.py
index 5faf4ee0..d97b55e3 100644
--- a/httpie/models.py
+++ b/httpie/models.py
@@ -71,7 +71,11 @@ class HTTPResponse(HTTPMessage):
@property
def headers(self):
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:
# Assume HTTP/1.1
raw_version = 11
@@ -79,7 +83,7 @@ class HTTPResponse(HTTPMessage):
9: '0.9',
10: '1.0',
11: '1.1',
- 20: '2',
+ 20: '2.0',
}[raw_version]
original = self._orig