percolator
percolator copied to clipboard
etags support
add etags support. (to simple resources and CRUDCollection)
If an etag($) function is defined...
- GETs return the etag($) return value in the ETag header as a quoted string.
- If the client sends an If-Match header that matches it, then PUTs and DELETEs should be allowed to succeed, otherwise a 412 response (Precondition Failed) should be sent.
- If the client sends an If-None-Match header that matches it, then GETs should return a 304 (Not Modified) response.
If fetch($) is defined for a resource, the etag($) function should be executed AFTER fetch($) so that $.fetched is available to the etag($) function.
I just realized that the interface must optionally include the full body of the response, in case the etag depends on it (eg it's a hash of the body). If the etag() function definition only takes $, it could be calculated without the body though.