📝 Move Query params - str validations to better name

This commit is contained in:
Sebastián Ramírez
2018-12-14 17:25:44 +04:00
parent 1f5762703d
commit d79534b015
12 changed files with 12 additions and 12 deletions

View File

@@ -0,0 +1,11 @@
from fastapi import FastAPI, Query
app = FastAPI()
@app.get("/items/")
async def read_items(q: str = Query(None, max_length=50)):
results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
if q:
results.update({"q": q})
return results