committed by
Yurii Motov
1 changed files with 2 additions and 3 deletions
@ -1,12 +1,11 @@ |
|||
from typing import Annotated |
|||
|
|||
from fastapi import FastAPI, Query |
|||
from typing import Annotated, Optional |
|||
|
|||
app = FastAPI() |
|||
|
|||
|
|||
@app.get("/items/") |
|||
async def read_items(q: Annotated[str | None, Query()] = ...): |
|||
async def read_items(q: Annotated[Optional[str], Query()] = ...): |
|||
if q in ("None", "", "null"): |
|||
q = None |
|||
return {"q": q} |
|||
|
|||
Loading…
Reference in new issue