Query and Header parameters can be lists:
from typing import List
from fastapi import FastAPI, Query
app = FastAPI()
@app.get("/items/")
def read_items(q: List[int] = Query(None)):
return {"q": q}
With a URL of /items/?q=5&q=6
, q
will contain [5, 6]
.
To define query or header parameters as lists it is necessary to explicitly use Query
or Header
, otherwise, FastAPI will assume they are request bodies.
100% coverage
FastAPI is fully tested.
The tests cover 100% of the source code.
Automatic Security checks and utils
Security utils, like HTTPBasic
have checks that directly return HTTP errors to the client when the scheme is invalid or doesn't contain data.
There are new models to contain the value of HTTP security utils, as HTTPBasicCredentials
, that contains the decoded username
and password
.
Bug fixes for Python 3.7
Several fixes for Python 3.7. For issues that didn't show in Python 3.6.
Docs
Several new tutorials and docs.
Improvements to existing docs.