fix(remote): map a cut-off answer to a recoverable error and stop trusting an empty optional answer

This commit is contained in:
imSp4rky
2026-11-28 21:03:54 -07:00
parent 74fa29b6f1
commit f5c8858e6e
12 changed files with 279 additions and 76 deletions
+3 -2
View File
@@ -413,7 +413,7 @@ def test_a_body_over_the_limit_is_cut_and_marked(server, debug_log, monkeypatch,
assert (response["body"], response["body_size"], response["body_cut"]) == ('{"xyz', 13, True)
def test_a_failed_body_read_is_recorded_and_left_to_the_caller(debug_log):
def test_a_failed_body_read_is_recorded_and_raised_again(debug_log):
class Broken:
status_code = 200
headers = {"content-type": "application/json"}
@@ -423,7 +423,8 @@ def test_a_failed_body_read_is_recorded_and_left_to_the_caller(debug_log):
raise rq.exceptions.ChunkedEncodingError("cut short")
response = Broken()
http_session.record_request("GET", "http://h/api", 1, response=response, body=True)
with pytest.raises(rq.exceptions.ChunkedEncodingError):
http_session.record_request("GET", "http://h/api", 1, response=response, body=True)
(entry,) = records(debug_log)
assert entry["response"]["body_error"].startswith("ChunkedEncodingError")