diff --git a/cachecontrol/adapter.py b/cachecontrol/adapter.py index 27f58fc7..fe6643e9 100644 --- a/cachecontrol/adapter.py +++ b/cachecontrol/adapter.py @@ -58,6 +58,11 @@ def build_response(self, request, response): resp = self.controller.update_cached_response( request, response ) + # Fix possible exception when using missing `raw` field in + # requests + # TODO: remove when requests will be bump to 2.2.2 or 2.3 + # version + resp.raw = None else: # try to cache the response self.controller.cache_response(request, resp)