Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
* `def .aiter_text()` - **async text iterator**
* `def .aiter_lines()` - **async text iterator**
* `def .aclose()` - **None**
* `def .next()` - **Response**
* `def .anext()` - **Response**

## `Request`

Expand Down
2 changes: 1 addition & 1 deletion httpx/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ async def aiter_raw(self) -> typing.AsyncIterator[bytes]:
yield part
await self.aclose()

async def next(self) -> "Response":
async def anext(self) -> "Response":
"""
Get the next response from a redirect response.
"""
Expand Down
8 changes: 4 additions & 4 deletions tests/client/test_redirects.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async def test_no_redirect():
response = await client.get(url)
assert response.status_code == 200
with pytest.raises(NotRedirectResponse):
await response.next()
await response.anext()


@pytest.mark.usefixtures("async_environment")
Expand Down Expand Up @@ -151,7 +151,7 @@ async def test_disallow_redirects():
assert response.is_redirect is True
assert len(response.history) == 0

response = await response.next()
response = await response.anext()
assert response.status_code == codes.OK
assert response.url == URL("https://example.org/")
assert response.is_redirect is False
Expand Down Expand Up @@ -216,7 +216,7 @@ async def test_too_many_redirects_calling_next():
response = await client.get(url, allow_redirects=False)
with pytest.raises(TooManyRedirects):
while response.is_redirect:
response = await response.next()
response = await response.anext()


@pytest.mark.usefixtures("async_environment")
Expand All @@ -233,7 +233,7 @@ async def test_redirect_loop_calling_next():
response = await client.get(url, allow_redirects=False)
with pytest.raises(RedirectLoop):
while response.is_redirect:
response = await response.next()
response = await response.anext()


@pytest.mark.usefixtures("async_environment")
Expand Down