Defining a new HTTP method: HTTP SEARCH
httptoolkit.tech
httptoolkit.tech
With the correct header variables, such as Accept-Content, we can settle on nice standardised database querying over the web. Think beyond web pages, and think about proper client-server applications, where the developer doesn't have to re-invent the wheel, or use a framework that may not be in use or supported a few years down the line.
Imagine using curl to do a HTTP SEARCH and piping the response directly into your app or other command line tools. No time wasted developing or installing supporting libraries - it just works.
Edit: Now I think about it, maybe SEARCH is the wrong name. Using SQL as a [bad] example, it would be odd to use HTTP SEARCH to do an insert or update query.
Some people do this sort of thing with sending GraphQL queries to GET routes which may do some validation and then send the query back through. Is there a downside to using GET here?
Also SEARCH was suppose to be case when you don't mutate data, so SQL insert and update is not good usage of it. You should use POST for that.
This would have us forgo cacheability, forgo the ability to send a link to a search, introduce more complexity into web servers and clients, all just to be able to send query parameters in the request body.
That was the unique selling point of SEARCH over POST though.
How about using the Range header with a custom value domain instead?
Search is idempotent in the sense that it doesn't change anything on the server, other than mutating caches (which should be idempotent).
[edit: or maybe it's standard but not REST-compliant?]
I wouldn't recommend anyone to rely on it to work - especially not if you are using public/cloud infrastructure.
> A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.
So it's non-non-standard but not standard either. If I understand correctly a GET with body is about as defined as a POST with body, but since it is not often used the real world support is worse. What is a lot better specified about POST is response codes, like 201 Created and (I'm guessing) content negotiation.
Browsers seem pretty strict about it though, `fetch('/', {body: ''})` gives a TypeError for me but `fetch('/', {body: '', method: 'POST'})` does not.
I like the concept in general, like a GET w/ data or a cacheable POST, meant to query/retrieve information so you have a semantic distinction for that as well.
I don't like it, but it is very common.