summaryrefslogtreecommitdiff
path: root/requests_cache/models/raw_response.py
diff options
context:
space:
mode:
Diffstat (limited to 'requests_cache/models/raw_response.py')
-rw-r--r--requests_cache/models/raw_response.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/requests_cache/models/raw_response.py b/requests_cache/models/raw_response.py
index 5850b2a..dfc5591 100644
--- a/requests_cache/models/raw_response.py
+++ b/requests_cache/models/raw_response.py
@@ -53,7 +53,7 @@ class CachedHTTPResponse(RichMixin, HTTPResponse):
kwargs['request_url'] = raw._request_url
# Copy response data and restore response object to its original state
- if hasattr(raw, '_fp') and not is_fp_closed(raw._fp):
+ if getattr(raw, '_fp', None) and not is_fp_closed(raw._fp):
body = raw.read(decode_content=False)
kwargs['body'] = body
raw._fp = BytesIO(body)