2 ms·
No, not idempotent operations; safe operations. When speaking of HTTP methods, PUT and DELETE are both idempotent but not safe; you wouldn’t the user agent to D
by chrismorgan 9y ago
No, not idempotent operations; safe operations. When speaking of HTTP methods, PUT and DELETE are both idempotent but not safe; you wouldn’t the user agent to DELETE a resource based on merely a hint—it needs to wait until the actual response comes in, at which point it can confirm whether the header is there and to be acted upon.
See https://tools.ietf.org/html/rfc7231#section-4.2 https://tools.ietf.org/html/rfc7231#section-4.2 for the definitions.
(Keep in mind with 103’s semantics that we’re not talking about HTTP methods, we’re merely borrowing its definition of “safe”. Speculative JavaScript execution, for example, is perfectly feasible; you’d simply have to pause execution as soon as it tried to mutate its environment or make HTTP requests or things like that. How useful it is is another question.)
- rusk 9y agoI took idempotent and safe to be functionally equivalent. i.e. that which causes no state-change on the server. Thanks for the correction. Effectively a "debounced" operation.
- chrisrhoden 9y agoIdempotent just means that you can do it as many times as you want (n) and the state will remain the same, for n >= 1.
- rusk 9y agoThe origin of my confusion is the definition of GET as idempotent. My understanding of this verb is it (should) cause no mutations. So the correct classification of GET is "safe".
- chrismorgan 9y agoSafe is a subset of idempotent. Idempotent means that one invocation has the same effect as more than one invocation. Safe means that zero invocations has the same effect as one or more invocations.
- rusk 9y agoYeah I understand how the categories work but the language was heretofire confusing