vcrpy
vcrpy copied to clipboard
Fix not working for binary response in httpx
The httpx_reponse.content.decode("utf-8", "ignore") would corrupt binary content that can't decoded to unicode. We should serialize the binary content directly in that case.
A better way to fix this is probably is set the content to response["body"]["string"] because vcr.serializers.compat.convert_to_unicode() and vcr.serializers.compat.convert_to_bytes() handle the bytes / unicode conversion of that field. But that will change the cassette format for httpx. I guess you guys can consider that when implementing #463.
Also fixed in #784
I suggest we close this one in view of #784