I still don't get the need for QUERY. One can create a search or filter resource with a POST request and then query it using GET. As a bonus, creating a resource allows it to be shared and cached.
Obviously the approach you mentioned has the downside of two server round-trips being necessary while the QUERY request only requires a single round-trip. Not to mention the two-request approach adds more complexity to both clients and servers, as it mandates that both the client and server have to physically create and manage those resources.
The new HTTP QUERY method explained
121–130 of 179 posts
Re: The new HTTP QUERY method explained
#122Earlier quoted context omitted.
Elastic/Opensearch uses GET requests with a body for search, which is complicated or forbidden (not exactly sure) with the HTTP spec. Not all HTTP clients are willing to submit a body with a GET. So opensearch also allows you to POST search requests, but those are uncacheable QUERY would fit here perfectly - it's probably trivial for opensearch to add but it will take some time for clients to catch up.
Fixing GET would be easier. And yes,it would be fixing a flawed interpretation of what should be implemented.you are, by definition GETting something. Tools dropping body from GET by default are violating the spec today. Rules configured to drop it are just that, temporarily configured constraints readily modified. Adding QUERY will make it unpredictable in effectively the same manner as GET/body. It'll take even lon…
I disagree. I think the adoption (or dismissal) of QUERY will show.
First thing that comes to mind is that the idempotency of GET resources are easy to handle. URL's have a fixed size, they can be efficiently hashed, cached and are unambiguous about how they serve this purpose.
It is unclear how the ecosystem will deal with the QUERY requirements. It's easy for apps, but browsers, http caches and servers will take some time to figure out solutions.
Fixing GET would have the same amount of uncertainty in addition to the need to keep current expectations valid. It's not easier, it's harder.
Re: The new HTTP QUERY method explained
#123It's interesting to see additions to HTTP methods as it much feels like the existing ones are set in stone. At least for the time that I have been a developer. I'm curious to see how fast the adoption/support for HTTP QUERY will be. I've had my fair share of situations where I wished for something like HTTP QUERY.
Re: The new HTTP QUERY method explained
#124It blows my mind that people are invested in this. HTTP is a 35+ year old text-based protocol. Its becoming the COBOL of digital transmission. Just as one example, among many, you could try WebSockets (or some other similar protocol) and then push anything over it. Your message could be plain text, JSON, binary, whatever. Web Sockets and protobufs are bidirectional (full duplex) too.
Re: The new HTTP QUERY method explained
#125What are the chances sites start using this to prevent sharing links...
With some post websites (banking) and spa already present.
Re: The new HTTP QUERY method explained
#126"QUERY is just GET" "Using GET with a Body works" Seems like this is going everyone's head. You're not supposed to use GET with a Body, this is a hack, therefore having an explicit method makes sense. Just because it works, doesn't mean its the right way
It sounds like GET with a body is just undefined behavior. Why not just standardize it? It seems to be a better way than adding a new method.
Re: The new HTTP QUERY method explained
#127Earlier quoted context omitted.
The article also addresses why this is not the chosen solution. It's pretty much the first one you'd think of: all kinds of existing software (that can be between client and server and out of their control) already handle GET bodies in all kinds of incompatible ways, because the existing standard says they're meaningless and "shouldn't" be included. The idea is to not break people's stuff, so they don't rugpull the e…
So, I need to update all the tools to support QUERY, or I need to update all the tools to support GET/body. So, either way, I need to update all the tools. Just fix GET.
If you make it a whole new request method, existing unpatched software should just respond with "Method not allowed".
Re: The new HTTP QUERY method explained
#128Earlier quoted context omitted.
Even past the TLS point (CDNs terminate TLS, so they can read the body) there's a harder problem nobody's solved: to cache a QUERY the cache has to fold the body into the cache key, and there's no standard way to canonicalize a request body. {"a":1,"b":2} and {"b":2,"a":1} are the same query and two different cache entries; whitespace, float formatting, unordered keys all fork the key. GET gets this for free because…
I think the simple approach of using a bitwise comparison will result in satisfactory caching for most applications.
Re: The new HTTP QUERY method explained
#129It blows my mind that people are invested in this. HTTP is a 35+ year old text-based protocol. Its becoming the COBOL of digital transmission. Just as one example, among many, you could try WebSockets (or some other similar protocol) and then push anything over it. Your message could be plain text, JSON, binary, whatever. Web Sockets and protobufs are bidirectional (full duplex) too.
Just because it's old doesn't mean it is worse than alternatives, most likely it is quite the contrary.
Re: The new HTTP QUERY method explained
#130Earlier quoted context omitted.
Obviously the approach you mentioned has the downside of two server round-trips being necessary while the QUERY request only requires a single round-trip. Not to mention the two-request approach adds more complexity to both clients and servers, as it mandates that both the client and server have to physically create and manage those resources.
Obviously, yes, but is it simpler to add a new HTTP method and add support for it everywhere?
I understand the confusion around GraphQL's cached/persisted queries, but this is not the intention of HTTP.