FastAPI - Dependency Injection
Given this code snippet, what will be printed when a request is made to
/items/42?
from fastapi import FastAPI, Depends
app = FastAPI()
def common_dep():
print("Global dependency called")
@app.get("/items/{item_id}")
def read_item(item_id: int, dep=Depends(common_dep)):
return {"item_id": item_id}