Question

I'm working on implmenenting ETag functionality for a RESTful service, and I'd like to be as close to the HTTP spec as possible. The spec however is not as clear as it probably should be. Specifically:

The If-Match header - what are it's semantics for a GET request?

Presumably, a GET with the If-Match header will, if the value is matched with the value of the ETag - return the actual Resource with 200 OK (not 304). If the value is not matched, a 412 Precondition Failed should be returned, along with the new value of the ETag and no content?

Was it helpful?

Solution

That's correct, expect that the new value of the ETag on a 412 response to a If-Match is nowhere required by the spec. You can omit it. It's only recommended on a 304 response to a If-None-Match. Perhaps that's where your confusion was caused.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top