Recording requests does not work for non-UTF8 data
samamorgan opened this issue · comments
from httpretty import HTTPretty
import requests
with HTTPretty.record("image.json", allow_net_connect=True):
requests.get("https://httpbin.org/image/jpeg")
This raises UnicodeDecodeError
because the record method is always trying to decode the response body.
https://github.com/gabrielfalcao/HTTPretty/blob/main/httpretty/core.py#L1540
I assume the same thing will happen if I try to record a POST request with binary data because of:
https://github.com/gabrielfalcao/HTTPretty/blob/main/httpretty/core.py#L1535