You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, this is my first time posting here so bear with me 🙂
I came across the new QUERY HTTP method (there's a draft spec here: https://http.dev/query) and thought it'd be cool if Starlette supported it. Basically it's like a GET but lets you send a body, useful for complex search/filter requests where query strings get messy.
I tried it locally and it actually already kind of works if you just do:
Route("/search", search, methods=["QUERY"])
since Starlette doesn't seem to hardcode the method list in the router itself.
But I noticed a couple spots that do have a fixed list of methods and would probably need QUERY added:
HTTPEndpoint in endpoints.py only checks for GET/HEAD/POST/PUT/PATCH/DELETE/OPTIONS, so you can't add a .query() method to a class-based endpoint right now
schemas.py has a similar fixed list for generating the OpenAPI schema
Before I try to open a PR (first one for me, so go easy 😅), wanted to check:
Is this something you'd even want, given the spec isn't finalized yet?
Any concerns about security here? I saw the recent advisory about HTTPEndpoint dispatching methods via getattr, so I want to make sure I'm not making that worse.
Would .query() be the right name for the handler method on HTTPEndpoint?
Let me know if this is worth pursuing and I'll put a PR together.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hey, this is my first time posting here so bear with me 🙂
I came across the new
QUERYHTTP method (there's a draft spec here: https://http.dev/query) and thought it'd be cool if Starlette supported it. Basically it's like aGETbut lets you send a body, useful for complex search/filter requests where query strings get messy.I tried it locally and it actually already kind of works if you just do:
since Starlette doesn't seem to hardcode the method list in the router itself.
But I noticed a couple spots that do have a fixed list of methods and would probably need
QUERYadded:HTTPEndpointinendpoints.pyonly checks for GET/HEAD/POST/PUT/PATCH/DELETE/OPTIONS, so you can't add a.query()method to a class-based endpoint right nowschemas.pyhas a similar fixed list for generating the OpenAPI schemaBefore I try to open a PR (first one for me, so go easy 😅), wanted to check:
HTTPEndpointdispatching methods viagetattr, so I want to make sure I'm not making that worse..query()be the right name for the handler method onHTTPEndpoint?Let me know if this is worth pursuing and I'll put a PR together.
All reactions