mirror of https://github.com/tiangolo/fastapi.git
21 lines
396 B
Python
21 lines
396 B
Python
from fastapi import FastAPI, Header
|
|
from pydantic import BaseModel
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
class CommonHeaders(BaseModel):
|
|
class Config:
|
|
extra = "forbid"
|
|
|
|
host: str
|
|
save_data: bool
|
|
if_modified_since: str | None = None
|
|
traceparent: str | None = None
|
|
x_tag: list[str] = []
|
|
|
|
|
|
@app.get("/items/")
|
|
async def read_items(headers: CommonHeaders = Header()):
|
|
return headers
|