Skip to content
Myr

Add missing `Response.next()` (#1055)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Florimond Manca · committed by GitHub · parent 330a825 · Browse files · 2 files+10 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+10 added−1 removed

  • tests:+1 added−1 removed
  • other:+9 added−0 removed

2 files+10 added−1 removed

modified:httpx/_models.py+9 added
941 unmodified lines
942 for part in self._raw_stream:943 yield part944 self.close()945946 def next(self) -> "Response":947 """948 Get the next response from a redirect response.949 """950 if not self.is_redirect:951 raise NotRedirectResponse()952 assert self.call_next is not None953 return self.call_next()954955 def close(self) -> None:956 """957 Close the response and release the connection.958 Automatically called if the response body is read to completion.
253 unmodified lines
modified:tests/client/test_redirects.py+1 added-1 removed
308 unmodified lines
309 url = "https://example.org/multiple_redirects?count=21"310 response = client.get(url, allow_redirects=False)311 with pytest.raises(TooManyRedirects):312 while response.is_redirect:313 response = response.call_next()313 response = response.next()314315316@pytest.mark.usefixtures("async_environment")317async def test_redirect_loop():
168 unmodified lines