codejump

Dependency Basics

Preview — 3 of 10 questions

What does Depends(get_settings) tell FastAPI to do for a request?

AImport a module named get_settings
BStore the route result in a cache forever
CRun get_settings only at application startup
DCall get_settings and inject its result

Where does FastAPI get a simple limit: int = 10 parameter declared inside a dependency when it is absent from the path?

AFrom the application name
BFrom the OpenAPI title
CFrom the query string, with 10 as default
DFrom the response body

What value reaches user in user: User = Depends(load_user)?

AThe raw Authorization header without parsing
BThe value returned by load_user
CThe load_user function object itself
DAlways None

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.