-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
# app.py
@router.post("/login")
async def login(response: Response):
# ...omit
response.set_cookie(
key=ACCESS_TOKEN_COOKIE_KEY,
value=token_value,
)
return ...
# conftest.py
@pytest.fixture()
async def async_client(app: FastAPI) -> AsyncGenerator:
async with AsyncClient(app=app, base_url="http://test") as ac:
yield ac
# test_blablabla.py
async def test_login(async_client):
response = await async_client.post("/login", json={...})
# `response.cookies` is empty here and not being persistedExpected
As the docs says, response.cookies should contain access token
Actual
response.cookies is empty
Metadata
Metadata
Assignees
Labels
No labels