Description
I've noticed that I can't define some GET endpoint as such:
@app.get("/items/{item_id}")
def read_item(item_id: int, q: string = None, **kwargs):
return {"item_id": item_id, "q": q, **kwargs}
Meaning, I can't define a route that will take arbitrary query params (i.e., not stipulated by the API schema itself). Am I missing something, or was this a conscious design decision?
@Datamance you can get the raw Request object directly and extract all the query parameters (defined or not): https://fastapi.tiangolo.com/tutorial/using-request-directly/
馃憦 馃憦 馃憦 thank you!
Great! I'll then close this issue now. But feel free to add me comments or create new issues.
@Datamance you can get the raw
Requestobject directly and extract all the query parameters (defined or not): https://fastapi.tiangolo.com/tutorial/using-request-directly/
For those stumbling on this issue, here's an updated link: Using the Request Directly
Most helpful comment
For those stumbling on this issue, here's an updated link: Using the Request Directly