Document Update Rejects the Current Quoted If-Match ETag
Level 2 · node · API · ETag version parsing contract error
Scenario
A document editing API uses the ETag from a read response as If-Match on the next PATCH for optimistic concurrency control. HTTP ETag values arrive quoted, but even a client that just read the latest document gets 412. The controller, update service, and repository are separated, and the repository stores version as a number.
Requirements
- Compare a quoted integer If-Match ETag with the current numeric version - When If-Match matches the current version, update the document and increment version by exactly one - Reject a stale If-Match version with 412 without changing the document - Reject a missing or malformed integer ETag with 400 - On a valid update, persist provided title and body fields
Acceptance criteria
- Updating with a quoted ETag for the current version returns 200
- A successful update increments version by exactly one
- A stale ETag returns 412 and leaves the stored document unchanged
- A missing or malformed If-Match returns 400
- A successful update preserves the provided title and body in the repository