-
|
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? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
@Datamance you can get the raw |
Beta Was this translation helpful? Give feedback.
-
|
👏 👏 👏 thank you! |
Beta Was this translation helpful? Give feedback.
-
|
Great! I'll then close this issue now. But feel free to add me comments or create new issues. |
Beta Was this translation helpful? Give feedback.
-
For those stumbling on this issue, here's an updated link: Using the Request Directly |
Beta Was this translation helpful? Give feedback.
@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/