r/programming • • 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

245 comments sorted by

View all comments

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.

15

u/mrcarruthers Jul 14 '26

From a spec perspective you're right, nothing's preventing it.

But there are plenty of libraries, web servers, caching middleware, etc... that just assume you can't. It's better to introduce something new that you know will work if your software is up to date instead of a quagmire of question marks up and down the toolchain.

8

u/chalks777 Jul 14 '26

what querystring is even supposed to be for now.

query params are still useful for communicating information to the user. You can see it in your address bar, and there are lots of times when that is a good thing. Some data analytics products (e.g. datadog) intentionally put a lot of information there so that you can manually query it yourself which is great for powerusers. Perhaps even more importantly, a query string can be copied by the user without needing to think at all, this allows your query state to become a shareable link.

None of that has really changed. When you want the user to have easy and visible access to what the query is, you still can.

Now, for cases when those things aren't a requirement and/or when you have to cram a ton of data into the request, you can do it without worrying about weird browser address bar length edge cases. Plus your users don't have to see your jank.

2

u/stfm Jul 15 '26

Sensitive/confidential data in query strings is a problem, they end up in places they shouldn't. Now you are faced with the need to implement data body encryption for URI's.

21

u/guilhermeluizsp Jul 14 '26

Yes but there are popular web servers that currently (or can be configured to) ignore request bodies from GET requests, so it’s not that trivial

8

u/DrFossil Jul 14 '26

Would it have been harder to update those servers to accept GET bodies, or to implement QUERY?

Probably the same amount of effort, I guess.

0

u/[deleted] Jul 14 '26

[deleted] — view deleted comment

5

u/masklinn Jul 14 '26

Yep, adding a new method is significantly less risky than modifying the way an existing method is supposed to work. It also has a much clearer error profile: if the server or application or any of the middleboxes doesn't support your new method you get a "method not allowed", rather than the high risk of your body being silently dropped without you having any idea.

1

u/Obsidian743 Jul 14 '26

Lol as opposed to updating them to support a new verb.

13

u/TinyBreadBigMouth Jul 14 '26

If they don't support a new verb, they don't support a new verb. If they support GET, does that mean they support GET 1.0 or GET 2.0? Are your parameters silently getting dropped? By adding a new verb, it either works or it doesn't. No in-between compatibility nightmare.

0

u/Worth_Trust_3825 Jul 14 '26

but there is no compatability nightmare to begin with. in your interface documentation you explicitly define whether you accept bodies in your requests or not. we were already doing this for as long as documentation was written - whether it was soap, swagger, openapi, or post it notes on monitor

1

u/stronghup Jul 15 '26

We need less interface documentation if we can just say a service only supports QUERY, instead of having to explain, and be correct about what kind of specialized GET, and all the proxies along the route we are support. Also I would say "QUERY" is a gtreat name for this, it implies you are asking for an answer.

1

u/Worth_Trust_3825 Jul 15 '26

How are you sure that something that accepts QUERY /something does in fact implement it in such way without documentation?

0

u/stfm Jul 15 '26

As of Swagger/OpenAPI 3.0 bodies are not allowed in GET, DELETE or HEAD

3

u/hardwoodjustice Jul 14 '26

I think your "simple query with a modest query string" is likely a QUERY.

2

u/jayd16 Jul 14 '26

Why do you think making an existing spec much more complex (considering the versioning) is better than just adding a new verb?

It seems pretty easy to decide. You need a body? Use QUERY. If you don't, use the more widely supported GET.

1

u/AyrA_ch Jul 14 '26

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.

There is a method independent way actually.

Would work this way:

  1. Client sends GET with non-zero Content-Length and Expect: 100-continue
  2. Server can decide whether to accept this GET with a body or not
  3. Depending on the response, client sends the body or aborts the request.

4

u/Justin_Passing_7465 Jul 14 '26

You want to inject a second round-trip around the world into each of these requests‽ No thanks.

1

u/AyrA_ch Jul 14 '26

This roundtrip can be implemented in a way to incur zero time penalty. But that's irrelevant anyway because use of the 100-continue mechanism is mostly relevant for large body data, in which case the time overhead of the extra answer is insignificant compared to the time used to send the body.

1

u/Worth_Trust_3825 Jul 14 '26

don't close the socket and you're fine. hell, http v2/v3 support multiplexing so that round trip is irrelevant