mirror of
https://github.com/fastapi/fastapi.git
synced 2026-01-01 18:47:55 -05:00
Co-authored-by: Yurii Motov <yurii.motov.monte@gmail.com> Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
11 lines
214 B
Python
11 lines
214 B
Python
from typing import Union
|
|
|
|
from fastapi import FastAPI, Header
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/items/")
|
|
async def read_items(user_agent: Union[str, None] = Header(default=None)):
|
|
return {"User-Agent": user_agent}
|