instance method fresh?

Ruby on Rails 2.3.18

Since v2.3.18 Last seen in v2.3.18

Signature

fresh?(response)

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.

Parameters

response req
Source
# File actionpack/lib/action_controller/request.rb, line 136
    def fresh?(response)
      case
      when if_modified_since && if_none_match
        not_modified?(response.last_modified) && etag_matches?(response.etag)
      when if_modified_since
        not_modified?(response.last_modified)
      when if_none_match
        etag_matches?(response.etag)
      else
        false
      end
    end

Defined in actionpack/lib/action_controller/request.rb line 136 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionController::Request

Type at least 2 characters to search.

↑↓ navigate · open · esc close