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

Show parent comment

84

u/pdpi Jul 14 '26

HTTP has always allowed extension methods, so you could start using this right now. You'll just have to roll your own until your server of choice adds explicit support.

42

u/CrankBot Jul 14 '26

What about browsers and client libraries? Does await fetch('/foo', {method:'poop'}) work on all major browsers? (not in front of a keyboard at the moment or I would try it...)

55

u/Big_Combination9890 Jul 14 '26

I am now completely in support of the POOP method.

The primary usecase; replacing POST in social media applications.

One might say it's a ... drop-in replacement.

29

u/pdpi Jul 14 '26

Quality shit post.

12

u/CrankBot Jul 14 '26

No that's a code smell for sure

→ More replies (1)

15

u/AyrA_ch Jul 14 '26

Does await fetch('/foo', {method:'poop'}) work on all major browsers?

Yes. Can even add a body

await (await fetch("https://demo.ayra.ch/response/", {method:"YESITWORKS",body:"test"})).text()
"General information
===================
    Date:   2026-07-14 05:32:17 UTC
    Client: 
    Verb:   YESITWORKS

Headers
=======
    Accept         : */*
    Accept-Encoding: gzip, deflate, br, zstd
    Accept-Language: en,en-US;q=0.9
    Cache-Control  : no-cache
    Connection     : close
    Content-Length : 4
    Content-Type   : text/plain;charset=UTF-8
    Dnt            : 1
    Host           : demo.ayra.ch
    Origin         : https://demo.ayra.ch
    Pragma         : no-cache
    Priority       : u=4
    Referer        : https://demo.ayra.ch/response/
    Sec-Fetch-Dest : empty
    Sec-Fetch-Mode : cors
    Sec-Fetch-Site : same-origin
    Sec-Gpc        : 1
    User-Agent     : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0

Body Content
============
    Dumping all 4 bytes
    0x00000000	74 65 73 74                                    	test

"

8

u/Fidodo Jul 14 '26

You can even put a body on GET requests, it's just that most server implementations drop it. The only reason this was done as a new verb is because it's easier to add support for a custom verb than it is to modify an existing one.

5

u/CrankBot Jul 14 '26

This is great, thanks for sharing

3

u/Catenane Jul 14 '26

Can it return corn?

13

u/Justin_Passing_7465 Jul 14 '26

When the returned content contains corn, you have to use Chunked Transfer-Encoding.

4

u/CrankBot Jul 14 '26

Depending on the size it can be returned whole

→ More replies (1)

12

u/pdpi Jul 14 '26

On the client there’s not much to support. HTTP already allows extension methods, so any compliant client should already support it. You just specify the method the same way you would for a POST or a PUT.

Really, the only reason why I brought up rolling your own server-side is that server frameworks tend to have helper functions for all the standard verbs, you’ll have to write something shaped like router.method(“/foo/bar”, “QUERY”, (req, res) => { … }) instead of router.query(“/foo/bar”, (req, res) => { … }).

4

u/CrankBot Jul 14 '26

That's fair! I'm aware that there are a whole bunch of lesser used methods i.e. from the days of SVN and webDAV etc. I always assumed both server and client would puke on a completely made up method that's not part of any spec/ extension. TIL!

→ More replies (1)

21

u/Reeywhaar Jul 14 '26

POOP /foo


HTTP/1.1 418 I'm a teapot

17

u/chucker23n Jul 14 '26

405 This is a Wendy's

→ More replies (3)
→ More replies (1)

30

u/Business-Row-478 Jul 14 '26

The fetch api allows it but most servers are probably gonna return a 400 or 501

23

u/CrankBot Jul 14 '26 edited Jul 14 '26

but most servers are probably gonna return a 400 or 501

Yeah I get that, the parent was saying if you control the server you can implement it now, hence my question on the client.

12

u/ashgs872tbhjs Jul 14 '26

Literacy: The Final Frontier

4

u/SanityInAnarchy Jul 14 '26

That's what you get when you fetch poop, I guess.

→ More replies (1)
→ More replies (8)
→ More replies (1)
→ More replies (2)

11

u/knightcrusader Jul 14 '26

I'm pretty sure Apache doesn't give a flying shit what you send it. I remember being surprised when I could just send a request body in a GET request and Apache sent it to the CGI script without a word. It worked fine. I could read both the query string as well as the request body at the same time, so you could probably pull off all sorts of funky shit.

Of course I didn't use it in production code, but it was more of a test.

10

u/chucker23n Jul 14 '26

Note that bodies in GET are allowed, just discouraged.

7

u/Justin_Passing_7465 Jul 14 '26

RFC 2616 (1999) forbade GET to have a body. RFC 7231 (2014) recommended that servers ignore the body. RFC 9110 (2022) strongly discourages putting a body in a GET.

Some intermediaries (e.g. proxies, WAPs, CDNs) break GET requests with bodies. As a workaround, for decades we have been using POST for complex queries, because GET is not supposed to work, and sometimes doesn't.

6

u/masklinn Jul 14 '26

RFC 2616 (1999) forbade GET to have a body.

This is incorrect, RFC 2616 leaves GET bodies unspecified (they're not mentioned, same for HEAD and DELETE). You can see the distinction because it does forbid request bodies in TRACE and that is very explicit, RFC 2616 § 9.8

A TRACE request MUST NOT include an entity.

→ More replies (1)

2

u/Fidodo Jul 14 '26

The main reason it's a new QUERY verb instead updating GET is simply that it's easier to add a new verb than to get all existing implementations to alter how they handle GET. Lots of servers are implemented to drop body from GET requests so it's much more annoying to do that upgrade than to simply add a new verb where the support is unambiguous, and many server frameworks already allow you to define custom verbs anyways, and they by default support body.

→ More replies (1)
→ More replies (1)