Why do we need HTTP GET, PUT, or DELETE to be idempotent if TCP/IP is a reliable protocol that will retry requests on our behalf?
TCP/IP does not retry requests, it retransmits the original packets that make up each request, if necessary.
If a request fails (at the HTTP layer) it's the job of the client to retry it, not the network stack.
In particular, if the client (for what ever reason) fails to receive the response code indicating whether a RESTful operation succeeded or not, the client must be able to resend the same operation without having to worry about any unintended side effects.
These failures can happen - an intermediate firewall might have timed-out the connection while the server was processing the operation. The server won't know that this has happened, as soon as it has received the request it has to carry on regardless.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With