4 ms·
GET is supposed to be idempotent, and shouldn't have irreversible side-effects. Still a good idea, in my opinion. Browsers know they can repeat GET requests b
by zestyping 5y ago
GET is supposed to be idempotent, and shouldn't have irreversible side-effects. Still a good idea, in my opinion. Browsers know they can repeat GET requests but shouldn't repeat POST requests without explicit confirmation.
If I'm interviewing someone who claims to be familiar with HTTP, I expect them to know this. They might choose otherwise in specific situations for specific reasons, but they should know the convention.
- rmbyrro 5y agoHaving GET requests producing side-effects is not a good idea. Idempotent or not. Should avoid. GET requests should be used to retrieve information, they're supposed to be read-only. At most we could record like a counter or stats about the request, but not mutate resources internally.
- zestyping 5y agoYes, agreed. I was hedging because warming a cache could be technically considered a side-effect.
- rmbyrro 5y agoI'm not sure that's the case. The resource receiving the GET request isn't producing any side effects in reality. The caching server/service in front of it is. The underlying resource (behind the cache) doesn't (shouldn't?) even know about the cache itself. And the cache doesn't mutate any data points, just may store a version of it.