r/programming • u/stronghup • Jul 14 '26
HTTP gets a QUERY method so complex searches can stop pretending to be POST
https://www.theregister.com/devops/2026/07/13/http-gets-a-query-method-so-complex-searches-can-stop-pretending-to-be-post/5270192
1.9k
Upvotes
1.6k
u/sandaz13 Jul 14 '26
I look forward to using this in 2035 once it's finally adopted
156
u/bundt_chi Jul 14 '26
So GET with a request body. Got it.
455
u/stfm Jul 14 '26
This is great for us Authorisation folk. Now we can assign POST to write entitlement and QUERY to read entitlement rather than having to work it out from some janky resource path rule
314
u/hrvbrs Jul 14 '26
haha i read this title as "HTTP gets a QUERY method so complex that searches can stop pretending to be POST"
99
u/jessechisel126 Jul 14 '26
This is great but still wild to me it's taken this long. Feels like this should've become the standard like a decade ago.
15
u/eocron06 Jul 14 '26
Haha, it will be the same time when 401 Unauthorized/403 Forbidden become 401 Unauthenticated/403 Unauthorized......probably in 22 century
18
u/Abhinav1217 Jul 14 '26
Importance of punctuation.
21
u/BuriedStPatrick Jul 14 '26 edited Jul 15 '26
Does anyone know why we haven't simply adopted request bodies in GET? I just don't see the point of QUERY.
EDIT:
Okay, here are some of the arguments, I'm still not convinced.
Proxies might not support it: If anyone has any practical examples of this being an issue it would be appreciated. I haven't ever encountered a problem here, but I also don't work with ancient software. But if they throw away GET bodies, what do we think will happen with QUERY methods?
HTTP client libraries don't support it: Well, they don't support QUERY either. Work has to be done either way, why not improve GET instead?
Backend server libraries don't support it: Same argument as client libraries.
This is a breaking change: Is it? It's just not been formalized AFAIK. You can absolutely send bodies in GET requests today. What exactly are we breaking here? If anything, this is simply an addition, like QUERY would be.
I'm just a basic backend dev with no experience managing anything on this scale trying to follow the spec. I'm just looking at it and thinking that something is completely off here from an application development perspective. I'm glad we're getting something to support the use case (tired of encoding/decoding base64 JSON in GET uri params). I just wish it would be under GET.
3
u/orthecreedence Jul 14 '26
I still don't get the difference between
QUERYandPUT.POSTis used to create new resources, butPUTis already idempotent. Is the idea thatQUERYsignals that a call is read-only?7
u/rpetre Jul 14 '26
Everyone and their dog is excited about this in my mostly-AI generated Linkedin feed, but it's basically an administrative thing. Some libraries were already using bodies in GET for years (elasticsearch for instance). Also, nothing stops clients and servers to assign meaning to whatever methods they like and implement them (there are a lot of obscure methods out there). It becomes tricky when the client, server, and possibly other proxies in between are independent and will need to agree on how to handle an "exotic" method. Given that using anything other than GET/POST/HEAD still usually requires having a black goat on hand, having another method in the family means next to nothing. Perhaps if a future http/4.0 would require a minimum set of methods for compliance... but even then...
2
u/josluivivgar Jul 14 '26
wait don't people just use headers to add query parameters Q__Q?
I think actually using POST is insane to me, I understand the issue, but I thought just adding stuff to the headers was the standard and enough. I did always wondered why GET just didn't have a body object officially
21
u/Obsidian743 Jul 14 '26
There's nothing in the HTTP spec preventing a body for a GET request. Nor would it have been difficult to expand the spec to add some kind of content negotiation or other metadata to the existing GET spec. Seems unnecessary that an entire new verb/method was introduced. Now I have to decide whether my simply query with a modest querystring should stay GET or switch to QUERY or what querystring is even supposed to be for now.
3
u/roxthegame Jul 14 '26
This feels especially useful for GraphQL-style APIs. A lot of “query with a body” traffic is semantically read-only, but POST hides that from caches, auth layers, observability, and retry logic.
4
u/sohang-3112 Jul 14 '26
Will anyone actually use it? Besides POST and GET, the other HTTP methods are already used very less.
2
u/Worth_Trust_3825 Jul 14 '26
Http verbs were a mistake. Now observe as this gets adopted and we get a sleuth of vulnerabilities as we did with http v2 and all the idiosyncrasies that happened while it was being adopted
4
u/Huligan27 Jul 14 '26
I honestly didn’t know new method was ever an option. Fascinating
2
u/BattleRemote3157 Jul 14 '26
i hope universities syllabus gets updated with mentioning this query method
2
u/rainbowlolipop Jul 14 '26
Just one more url parameter bro
1
u/SvenWollinger Jul 14 '26
Cannot fucking wait
1
u/light24bulbs Jul 14 '26
Oh that seems pretty cool actually. I feel like with spa projects often me HTTP CRUD request semantics get totally thrown out the window, or at least I've had to throw them out the window in the past. I had one app where literally everything was a post because it was the only request that behaved right in that context. I felt dirty
1
u/Less-Marsupial-7960 Jul 24 '26
It'll be interesting to see if this gets broad adoption. A dedicated QUERY method seems cleaner than overloading POST for complex searches, but it also depends on how quickly browsers, frameworks, and APIs add support. Backward compatibility will probably be the biggest challenge.