Coverage for docs_src/header_param_models/tutorial001_py310.py: 100%

12 statements  

« 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

3 

4app = FastAPI() 1abcd

5 

6 

7class CommonHeaders(BaseModel): 1abcd

8 host: str 1abcd

9 save_data: bool 1abcd

10 if_modified_since: str | None = None 1abcd

11 traceparent: str | None = None 1abcd

12 x_tag: list[str] = [] 1abcd

13 

14 

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

16async def read_items(headers: CommonHeaders = Header()): 1abcd

17 return headers 1efghijklmnop