How to use HTTP If-Match for concurrent shipment updates
Where the API supports it, read the resource with its strong ETag and send that tag in If-Match when updating. If the update is stale, fetch the current record and reconcile the changes instead of retrying automatically with a newer tag.
Prevent overwrites at the origin server.
RFC 9110 section 13.1.1 specifies strong comparison for If-Match. The origin must not perform the requested method when the condition is false; a typical failure response is HTTP 412. Apply the version check and write atomically. An existence-only If-Match: * check does not protect against overwriting a specific newer version.
Two dispatchers change the same movement.
Two synthetic clients read the same shipment version. The first updates the vehicle; the second submits a revised stop against the earlier tag. The stale write must not overwrite the new vehicle. Fetch the current shipment, show both intended changes and apply a new request only after conflict resolution.
Separate concurrency, permissions and retry.
- Test two simultaneous authorised writes with the same tag. Verify the stale write causes no side effect.
- Test missing tags under your endpoint policy and confirm a weak tag cannot satisfy strong comparison.
- After a network timeout, determine whether the earlier request already succeeded before sending another write. A version precondition does not replace operation idempotency.