Skip to content

Commit

Permalink
Do not UTF-8-decode potentially-binary responses
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Dec 19, 2023
1 parent 2fab84c commit d7b3601
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def upgrade_cassette(cassette):
contentType = headers.get('content-encoding') or headers.get('Content-Encoding')
compressed_string = response['body']['string']
if contentType and contentType[0] == 'gzip':
response['body']['string'] = zlib.decompress(compressed_string, zlib.MAX_WBITS | 16).decode('utf-8')
response['body']['string'] = zlib.decompress(compressed_string, zlib.MAX_WBITS | 16)



class VCRGzipSerializer(object):
Expand Down

0 comments on commit d7b3601

Please sign in to comment.