codejump

Routes & Request Validation — Series 3

Preview — 3 of 10 questions

Which decorator handles a POST request to /items?

A@app.post("/items")
B@app.get("/items")
C@app.delete("/items")
D@app.options("/items")

What happens when a required integer path parameter receives abc?

APython silently converts it to zero
BThe handler receives the string abc
CThe route is deleted
DFastAPI returns a request validation error

With limit: int = 10 in a handler and no matching path placeholder, where does FastAPI read limit?

AFrom a request header
BFrom a cookie
CFrom the query string
DFrom the JSON body

Sign up free to play

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