FastAPI - Dependency Injection
What will be the output of the following FastAPI code when accessing
/items/3?
from fastapi import FastAPI, Depends
app = FastAPI()
def common_parameters(q: str = None):
return {"q": q}
@app.get("/items/{item_id}")
def read_item(item_id: int, commons: dict = Depends(common_parameters)):
return {"item_id": item_id, **commons}
