content = json.dumps(data).encode("utf-32-be")
headers = {"Content-Type": "application/json"}
# force incorrect guess from `guess_json_utf` to trigger error
- with mock.patch("httpx._models.guess_json_utf", return_value="utf-32"):
+ with mock.patch("httpx._models.guess_json_utf", return_value="utf-32-le"):
response = httpx.Response(
200,
content=content,
content = json.dumps(data).encode("utf-32-be")
headers = {"Content-Type": "application/json"}
# force incorrect guess from `guess_json_utf` to trigger error
- with mock.patch("httpx._models.guess_json_utf", return_value="utf-32"):
+ with mock.patch("httpx._models.guess_json_utf", return_value="utf-32-le"):
response = httpx.Response(200, content=content, headers=headers)
with pytest.raises(json.decoder.JSONDecodeError):
response.json()