🐛 Fix convert_underscores=False for header Pydantic models (#13515)

This commit is contained in:
Sebastián Ramírez authored and GitHub committed 2025-03-23 21:48:54 +01:00
1 parent c08a3e8f22
commit 2537d9d1c2
12 files changed
+457 -8

No files matched your search

@@ -0,0 +1,17 @@
from fastapi import FastAPI, Header
from pydantic import BaseModel
app = FastAPI()
class CommonHeaders(BaseModel):
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(convert_underscores=False)):
return headers