Coverage for docs_src/header_param_models/tutorial001_py39.py: 100%
13 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-01-13 13:38 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-01-13 13:38 +0000
1from typing import Union 1abcd
3from fastapi import FastAPI, Header 1abcd
4from pydantic import BaseModel 1abcd
6app = FastAPI() 1abcd
9class CommonHeaders(BaseModel): 1abcd
10 host: str 1abcd
11 save_data: bool 1abcd
12 if_modified_since: Union[str, None] = None 1abcd
13 traceparent: Union[str, None] = None 1abcd
14 x_tag: list[str] = [] 1abcd
17@app.get("/items/") 1abcd
18async def read_items(headers: CommonHeaders = Header()): 1abcd
19 return headers 1efghijklmnop