FastAPI - Dependency Injection
Given the code below, what will be the output when accessing
/items/42?
from fastapi import FastAPI, Depends
app = FastAPI()
def common_dep():
return "shared value"
@app.get('/items/{item_id}')
def read_item(item_id: int, value: str = Depends(common_dep)):
return {"item_id": item_id, "value": value}