Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Idempotence has nothing to do with it. POSTs are also Idempotent.


> Idempotence has nothing to do with it. POSTs are also Idempotent.

No, of the "base" HTTP/1.1 methods, all safe methods (GET, HEAD, OPTIONS, TRACE) and some unsafe methods (PUT and DELETE) are idempotent.

POST is neither safe nor idempotent (and safety is the key feature here, rather than idempotence.)

GET, HEAD, and POST are cacheable methods, which you may be confusing with idempotent methods. These are very different categories, however.


POSTs are not by definition idempotent. You can make a server response to a POST be idempotent but when you want multiple identical requests to have different effects, POST is the method to use (vs. GET, PUT, DELETE, etc.)

http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html


From

http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

9.1.1 Safe Methods

Implementors should be aware that the software represents the user in their interactions over the Internet, and should be careful to allow the user to be aware of any actions they might take which may have an unexpected significance to themselves or others.

In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval. These methods ought to be considered "safe". This allows user agents to represent other methods, such as POST, PUT and DELETE, in a special way, so that the user is made aware of the fact that a possibly unsafe action is being requested.

Naturally, it is not possible to ensure that the server does not generate side-effects as a result of performing a GET request; in fact, some dynamic resources consider that a feature. The important distinction here is that the user did not request the side-effects, so therefore cannot be held accountable for them.




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

Search: