Coverage for docs_src/header_param_models/tutorial002_pv1_py310.py: 100%
14 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-05-05 00:03 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-05-05 00:03 +0000
1from fastapi import FastAPI, Header 1abcd
2from pydantic import BaseModel 1abcd
4app = FastAPI() 1abcd
7class CommonHeaders(BaseModel): 1abcd
8 class Config: 1abcd
9 extra = "forbid" 1abcd
11 host: str 1abcd
12 save_data: bool 1abcd
13 if_modified_since: str | None = None 1abcd
14 traceparent: str | None = None 1abcd
15 x_tag: list[str] = [] 1abcd
18@app.get("/items/") 1abcd
19async def read_items(headers: CommonHeaders = Header()): 1abcd
20 return headers 1efghijkl