Skip to content
Myr

Rename 'next' to 'anext' on Response (#676)

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

* Rename 'next' to 'anext' on Response * Drop iscoroutinefunction() check

authored by Florimond Manca · committed by Tom Christie · parent d5da743 · Browse files · 3 files+6 added−6 removed
This commit

State

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

Trailers

  • Co-authored-by: Tom Christie <tom@tomchristie.com>

Diff stats

3 files+6 added−6 removed

  • tests:+4 added−4 removed
  • other:+2 added−2 removed

3 files+6 added−6 removed

modified:docs/api.md+1 added-1 removed
modified:httpx/models.py+1 added-1 removed
914 unmodified lines
915 async for part in self._raw_stream:916 yield part917 await self.aclose()918919 async def next(self) -> "Response":919 async def anext(self) -> "Response":920 """921 Get the next response from a redirect response.922 """923 if not self.is_redirect:
187 unmodified lines
modified:tests/client/test_redirects.py+4 added-4 removed
108 unmodified lines
109 url = "https://example.com/no_redirect"110 response = await client.get(url)111 assert response.status_code == 200112 with pytest.raises(NotRedirectResponse):113 await response.next()113 await response.anext()114115116@pytest.mark.usefixtures("async_environment")117async def test_redirect_301():
32 unmodified lines
150 assert response.url == URL("https://example.org/redirect_303")151 assert response.is_redirect is True152 assert len(response.history) == 0153154 response = await response.next()154 response = await response.anext()155 assert response.status_code == codes.OK156 assert response.url == URL("https://example.org/")157 assert response.is_redirect is False158 assert len(response.history) == 1
56 unmodified lines
215 url = "https://example.org/multiple_redirects?count=21"216 response = await client.get(url, allow_redirects=False)217 with pytest.raises(TooManyRedirects):218 while response.is_redirect:219 response = await response.next()219 response = await response.anext()220221222@pytest.mark.usefixtures("async_environment")223async def test_redirect_loop():
8 unmodified lines
232 url = "https://example.org/redirect_loop"233 response = await client.get(url, allow_redirects=False)234 with pytest.raises(RedirectLoop):235 while response.is_redirect:236 response = await response.next()236 response = await response.anext()237238239@pytest.mark.usefixtures("async_environment")240async def test_cross_domain_redirect():
133 unmodified lines