Put That Appends
A cart API exposes this endpoint. The client sends the request, the server commits it, and then the response is lost to a dropped connection, so the client re-sends the byte-identical request.
PUT /v1/carts/8821/items HTTP/1.1
Host: api.shop.example
Content-Type: application/json
{"sku": "TSH-91", "qty": 2}
HTTP/1.1 200 OK
Content-Type: application/json
{"items": [{"sku": "TSH-91", "qty": 2}]}
The handler runs INSERT INTO cart_items (cart_id, sku, qty) VALUES (...) and the table has no unique constraint on (cart_id, sku). What is the cart after the retry, and what does that say about the design?
Sign in to answer questions and track your progress
Sign In