vcrpy icon indicating copy to clipboard operation
vcrpy copied to clipboard

Fix not working for binary response in httpx

Open yhlam opened this issue 4 years ago • 2 comments

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.

yhlam avatar Jan 27 '21 02:01 yhlam

Also fixed in #784

parkerhancock avatar Dec 08 '23 04:12 parkerhancock

I suggest we close this one in view of #784

parkerhancock avatar Dec 08 '23 19:12 parkerhancock