Skip to content

Commit

Permalink
fix: omit strict attribute during response deserialization
Browse files Browse the repository at this point in the history
This prevents issues when deserializing responses serialized
by an earlier version of cachecontrol.
  • Loading branch information
dairiki committed May 24, 2023
1 parent 51b752b commit 240dc16
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cachecontrol/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ def prepare_response(self, request, cached, body_file=None):
# TypeError: 'str' does not support the buffer interface
body = io.BytesIO(body_raw.encode("utf8"))

# Discard any `strict` parameter serialized by older version of cachecontrol.
cached["response"].pop("strict", None)

return HTTPResponse(body=body, preload_content=False, **cached["response"])

def _loads_v0(self, request, data, body_file=None):
Expand Down

0 comments on commit 240dc16

Please sign in to comment.