Skip to content

Commit 3462999

Browse files
Rename 'next' to 'anext' on Response (#676)
* Rename 'next' to 'anext' on Response * Drop iscoroutinefunction() check Co-authored-by: Tom Christie <[email protected]>
1 parent d5da743 commit 3462999

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

docs/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
* `def .aiter_text()` - **async text iterator**
6969
* `def .aiter_lines()` - **async text iterator**
7070
* `def .aclose()` - **None**
71-
* `def .next()` - **Response**
71+
* `def .anext()` - **Response**
7272

7373
## `Request`
7474

httpx/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ async def aiter_raw(self) -> typing.AsyncIterator[bytes]:
916916
yield part
917917
await self.aclose()
918918

919-
async def next(self) -> "Response":
919+
async def anext(self) -> "Response":
920920
"""
921921
Get the next response from a redirect response.
922922
"""

tests/client/test_redirects.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ async def test_no_redirect():
110110
response = await client.get(url)
111111
assert response.status_code == 200
112112
with pytest.raises(NotRedirectResponse):
113-
await response.next()
113+
await response.anext()
114114

115115

116116
@pytest.mark.usefixtures("async_environment")
@@ -151,7 +151,7 @@ async def test_disallow_redirects():
151151
assert response.is_redirect is True
152152
assert len(response.history) == 0
153153

154-
response = await response.next()
154+
response = await response.anext()
155155
assert response.status_code == codes.OK
156156
assert response.url == URL("https://example.org/")
157157
assert response.is_redirect is False
@@ -216,7 +216,7 @@ async def test_too_many_redirects_calling_next():
216216
response = await client.get(url, allow_redirects=False)
217217
with pytest.raises(TooManyRedirects):
218218
while response.is_redirect:
219-
response = await response.next()
219+
response = await response.anext()
220220

221221

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

238238

239239
@pytest.mark.usefixtures("async_environment")

0 commit comments

Comments
 (0)