4 ms·
It's not about the "end user" developer of the server, it's about the middleware and the clients. A browser (for example) will happily retry a GET request that
by svieira 4y ago
It's not about the "end user" developer of the server, it's about the middleware and the clients. A browser (for example) will happily retry a GET request that times out, but will not automatically retry a POST request that does the same. Will that break a badly behaved web API? Yes. But that's like saying that "calling conventions are a useless spandrel because the consuming code can ignore the convention and just read from arbitrary memory".
- samatman 4y agoThat's actually a good example, because if the standard specified that POST must be idempotent, and that a POST without a uuid is invalid, we might have something here. Instead there's a workaround for a serious problem, and any client (browser being by no means the only client) which doesn't respect the convention can emit identical POSTs, with no way of knowing if that was intended.
- svieira 4y agoThe standard says "POST means NOT-IDEMPOTENT" and "clients MUST not re-issue a non-idempotent requests" and the client behavior naturally falls out of those two constraints.
- samatman 4y agoThe standard being completely backward and impossible to enforce is a problem!
- P5fRxh5kUvp2th 4y agostandards are agreements, they've never been there with the expectation of enforcement.
- samatman 4y agoUnenforceable and unenforced are very different things.
- P5fRxh5kUvp2th 4y agoUnless you've got state actors behind it, it's unenforceable, full stop. We saw this when MS would regularly ignore HTML standards.
- Ajedi32 4y agoPOST is intentionally not idempotent. If you want impotence, that's what PUT and DELETE are for. Sadly, browser support for those two methods is somewhat lacking. You can't specify that a form send a PUT request, for example, only GET or POST.
- Ferret7446 4y agoYou're looking for PUT.
- Sohcahtoa82 4y agoI agree. I can understand the annoyance for there being so many verbs, but at the very least, there must be two: One that is guaranteed to be idempotent, and one that isn't. Someone I know was trying to make a message board that was compatible with every browser. EVERY browser. Including Mosaic and Netscape 1.0. Which meant that everything was done using GET requests, including posting messages. He changed his tune when some spidering engine found his site and issued tons of GET requests that ended up flooding the board with comments and posts that looked like web search queries.
- P5fRxh5kUvp2th 4y agoI find that hilarious because that used to be such a well understood phenomenon that I can't believe no one told him about it. OTOH, sometimes the best teacher is experience.