Test allow_redirects=False

This commit is contained in:
Tom Christie 2019-04-29 16:08:31 +01:00
parent 05e0649e8f
commit b392b7ea59

View File

@ -108,6 +108,15 @@ async def test_redirect_303():
assert len(response.history) == 1
@pytest.mark.asyncio
async def test_disallow_redirects():
client = RedirectAdapter(MockDispatch())
response = await client.request("POST", "https://example.org/redirect_303", allow_redirects=False)
assert response.status_code == codes.see_other
assert response.url == URL("https://example.org/redirect_303")
assert len(response.history) == 0
@pytest.mark.asyncio
async def test_relative_redirect():
client = RedirectAdapter(MockDispatch())