문제

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?

도움이 되었습니까?

해결책

No, but you can use status code 428 Precondition Required (see http://greenbytes.de/tech/webdav/rfc6585.html#status-428).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top