mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-29 12:35:13 +00:00
fix(remote): map a cut-off answer to a recoverable error and stop trusting an empty optional answer
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user