Coverage for docs_src / cookie_param_models / tutorial002_py310.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-04-06 01:24 +0000

1from fastapi import Cookie, FastAPI 1abefcd

2from pydantic import BaseModel 1abefcd

3 

4app = FastAPI() 1abefcd

5 

6 

7class Cookies(BaseModel): 1abefcd

8 model_config = {"extra": "forbid"} 1abefcd

9 

10 session_id: str 1abcd

11 fatebook_tracker: str | None = None 1abefcd

12 googall_tracker: str | None = None 1abefcd

13 

14 

15@app.get("/items/") 1abefcd

16async def read_items(cookies: Cookies = Cookie()): 1abefcd

17 return cookies 1ghijklm