codejump

FastAPI Internals & Edge Cases — Series 3

Preview — 3 of 10 questions

A FastAPI sub-application is mounted at /reports. Which lifespan handlers run when only the main application starts?

AThe main application's lifespan, not the mounted sub-app's lifespan automatically
BBoth always run automatically
COnly the mounted app's lifespan
DNeither app's lifespan

A WebSocket dependency rejects a client after the connection is established. Which exception type fits WebSocket semantics?

AHTTPException with status 404
BRequestValidationError
CJSONDecodeError
DWebSocketException

A route is configured with status_code=204 and returns no content. What should the OpenAPI response describe?

AA required error object
BA redirect to the same URL
CA successful response without a body
DA JSON null response body

Sign up free to play

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