fix(session): retry an rnet response whose body ends early

This commit is contained in:
imSp4rky
2026-12-05 01:10:03 -07:00
parent 96e4a314fb
commit cd6046bf82
6 changed files with 137 additions and 34 deletions
+5 -2
View File
@@ -55,7 +55,7 @@ def test_a_with_block_gives_the_response_itself_and_its_content(cover_url: str)
def test_the_end_of_the_with_block_closes_the_response(cover_url: str) -> None:
with RnetSession().get(cover_url) as response:
with RnetSession().get(cover_url, stream=True) as response:
pass
with pytest.raises(RuntimeError):
@@ -63,7 +63,10 @@ def test_the_end_of_the_with_block_closes_the_response(cover_url: str) -> None:
def test_an_exception_in_the_with_block_propagates_and_the_response_still_closes(cover_url: str) -> None:
with pytest.raises(ValueError, match="raised inside the with block"), RnetSession().get(cover_url) as response:
with (
pytest.raises(ValueError, match="raised inside the with block"),
RnetSession().get(cover_url, stream=True) as response,
):
raise ValueError("raised inside the with block")
with pytest.raises(RuntimeError):