mirror of
https://github.com/fastapi/fastapi.git
synced 2026-05-05 14:16:20 -04:00
📝 Update source examples and docs from Python 3.9 to 3.10 (#14900)
This commit is contained in:
committed by
GitHub
parent
d06ab3f5c7
commit
c9e2277d8b
@@ -1,10 +0,0 @@
|
||||
from typing import Annotated, Union
|
||||
|
||||
from fastapi import FastAPI, Header
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/items/")
|
||||
async def read_items(user_agent: Annotated[Union[str, None], Header()] = None):
|
||||
return {"User-Agent": user_agent}
|
||||
@@ -1,10 +0,0 @@
|
||||
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}
|
||||
@@ -1,14 +0,0 @@
|
||||
from typing import Annotated, Union
|
||||
|
||||
from fastapi import FastAPI, Header
|
||||
|
||||
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}
|
||||
@@ -1,12 +0,0 @@
|
||||
from typing import Union
|
||||
|
||||
from fastapi import FastAPI, Header
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/items/")
|
||||
async def read_items(
|
||||
strange_header: Union[str, None] = Header(default=None, convert_underscores=False),
|
||||
):
|
||||
return {"strange_header": strange_header}
|
||||
@@ -1,10 +0,0 @@
|
||||
from typing import Annotated, Union
|
||||
|
||||
from fastapi import FastAPI, Header
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/items/")
|
||||
async def read_items(x_token: Annotated[Union[list[str], None], Header()] = None):
|
||||
return {"X-Token values": x_token}
|
||||
@@ -1,10 +0,0 @@
|
||||
from typing import Union
|
||||
|
||||
from fastapi import FastAPI, Header
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/items/")
|
||||
async def read_items(x_token: Union[list[str], None] = Header(default=None)):
|
||||
return {"X-Token values": x_token}
|
||||
Reference in New Issue
Block a user