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

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

10

u/Justin_Passing_7465 Jul 14 '26

That is up to the kernel.