A missing optional query
Take your time, follow the code and check your understanding.
The codeHTTP and validation
@app.get("/products")
def products(limit: int = 10):
return {"limit": limit}
# GET /productsYour answer4 min · no timer
Show solution and explanation
A query parameter with a default is optional. Omitting it uses the declared default, 10.
{"limit": 10}