percolator icon indicating copy to clipboard operation
percolator copied to clipboard

etags support

Open cainus opened this issue 13 years ago • 1 comments

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.

cainus avatar Jan 02 '13 21:01 cainus

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.

cainus avatar Jan 13 '13 04:01 cainus