Methods
Constants
HTTP_IF_MODIFIED_SINCE | = | 'HTTP_IF_MODIFIED_SINCE'.freeze |
HTTP_IF_NONE_MATCH | = | 'HTTP_IF_NONE_MATCH'.freeze |
Instance Public methods
Check response freshness (Last-Modified and ETag) against request If-Modified-Since and If-None-Match conditions. If both headers are supplied, both must match, or the request is not considered fresh.
# File actionpack/lib/action_dispatch/http/cache.rb, line 32 32: def fresh?(response) 33: last_modified = if_modified_since 34: etag = if_none_match 35: 36: return false unless last_modified || etag 37: 38: success = true 39: success &&= not_modified?(response.last_modified) if last_modified 40: success &&= etag_matches?(response.etag) if etag 41: success 42: end