Is there a way to make a compare-and-swap-style mechanism the only way to modify certain resources, whilst following the HTTP standard?
There's an If-Match
header which implements the correct behaviour however this header is optional: as far as I can tell, if If-Match
is not provided, the server should honour the PUT
. (That is, it's up to the client to decide whether it wants to compare-and-swap, or just swap.) Would it be acceptable to respond with 412 Precondition Failed
if the client tries to PUT
or POST
without providing an If-Match
header?