|
|
|
|
|
by social_quotient
466 days ago
|
|
Cool comment, got me thinking a bit and I’d like clarity if you don’t mind. Sorting in a GET request param doesn't alter the server's state. It only changes the data representation, not the underlying resources. This fits "safe" method def (RFC 9110) https://www.rfc-editor.org/rfc/rfc9110.html#safe.methods But I agree sorting feels like it’s doing “something”… which is where I got stuck thinking about this. But are you saying that the client view state (example of the sorted data) should not be handled by the server via GET? If that’s what your are thinking, I’d like to learn more on this rule. |
|
But changing the "default" sort order of a resource (either by physically shuffling the rows on disk or by setting some server-side global variable) would not.
I think it's the difference between making a sorted copy of a list (while leaving the original list untouched) and inline-sorting the list.
Same applies to filtering.
Even storing the processed results in a cache does not validate idempotency, because from a client's POV, the behavior of the next request would be the same, whether the server calculates the result fresh or pulls it from the cache.
(Edit: Realized, I mixed up "idempotent" and "safe" methods there. I was talking about "safe" methods - but those are what applies to GET requests and what can be represented by a hyperlink)