Skip to content
Myr

Close AsyncClient properly in test_async_next_request (#1361)

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

authored by Tom Christie · committed by GitHub · parent ca5f524 · Browse files · 1 file+10 added−10 removed
This commit

State

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

Diff stats

1 file+10 added−10 removed

  • tests:+10 added−10 removed

1 file+10 added−10 removed

modified:tests/client/test_redirects.py+10 added-10 removed
153 unmodified lines
154155156@pytest.mark.usefixtures("async_environment")157async def test_async_next_request():158 client = httpx.AsyncClient(transport=MockTransport(redirects))159 request = client.build_request("POST", "https://example.org/redirect_303")160 response = await client.send(request, allow_redirects=False)161 assert response.status_code == httpx.codes.SEE_OTHER162 assert response.url == "https://example.org/redirect_303"163 assert response.next_request is not None158 async with httpx.AsyncClient(transport=MockTransport(redirects)) as client:159 request = client.build_request("POST", "https://example.org/redirect_303")160 response = await client.send(request, allow_redirects=False)161 assert response.status_code == httpx.codes.SEE_OTHER162 assert response.url == "https://example.org/redirect_303"163 assert response.next_request is not None164165 response = await client.send(response.next_request, allow_redirects=False)166 assert response.status_code == httpx.codes.OK167 assert response.url == "https://example.org/"168 assert response.next_request is None165 response = await client.send(response.next_request, allow_redirects=False)166 assert response.status_code == httpx.codes.OK167 assert response.url == "https://example.org/"168 assert response.next_request is None169170171def test_head_redirect():172 """
227 unmodified lines