mirror of
https://github.com/fastapi/fastapi.git
synced 2026-11-23 01:48:43 +08:00
17 lines
373 B
Python
17 lines
373 B
Python
from typing import Union
|
|
|
|
from fastapi import FastAPI, Query
|
|
from typing_extensions import Annotated
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/items/")
|
|
async def read_items(
|
|
hidden_query: Annotated[Union[str, None], Query(include_in_schema=False)] = None,
|
|
):
|
|
if hidden_query:
|
|
return {"hidden_query": hidden_query}
|
|
else:
|
|
return {"hidden_query": "Not found"}
|