pythonasyncioapiasyncfastapiframeworkjsonjson-schemaopenapiopenapi3pydanticpython-typespython3redocreststarletteswaggerswagger-uiuvicornweb
15 lines
317 B
15 lines
317 B
from typing import Union
|
|
|
|
from fastapi import FastAPI, Header
|
|
from typing_extensions import Annotated
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/items/")
|
|
async def read_items(
|
|
strange_header: Annotated[
|
|
Union[str, None], Header(convert_underscores=False)
|
|
] = None,
|
|
):
|
|
return {"strange_header": strange_header}
|
|
|