mirror of
https://github.com/fastapi/fastapi.git
synced 2026-11-09 01:23:17 -05:00
17 lines
317 B
Python
17 lines
317 B
Python
from typing import Annotated
|
|
|
|
from fastapi import FastAPI, Header
|
|
from pydantic import BaseModel
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
class ClientHeaders(BaseModel):
|
|
x_client_name: str
|
|
x_client_version: str
|
|
|
|
|
|
@app.get("/items/")
|
|
async def read_items(client: Annotated[ClientHeaders | None, Header()] = None):
|
|
return client
|