Hacker News new | past | comments | ask | show | jobs | submit login
Yes, a POST can be idempotent, said HTTP RFC editor (twitter.com/jreschke)
1 point by rmedaer on Dec 13, 2021 | hide | past | favorite | 4 comments



Not sure why that is worth highlighting, it's pretty obvious?


Really? Reading blogs, articles, etc. 99% of them say "POST is idempotent". They never say "but it could be".


Huh, if anything the common argument is that POST is not idempotent by default (and thus isn't cached, needs consideration on automatic retries on errors (e.g. browsers will ask you if you want to send again, proxies can't auto-repeat it), ...), and then lots of advice how to structure your APIs so it is. Because spec very clearly doesn't guarantee it to be idempotent, but you can of course implement your specific application so it uses it in an idempotent way.


I think many people argue that it should be because of network and protocol properties.

http://home.here/setlighton > http://home.here/togglelight. If the answer gets lost and the command is repeated, you have an unknown state of the light in the second case, but both requests are perfectly valid of course.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: