Skip to content

Commit

Permalink
etag header is in Rack, so use it's response methods
Browse files Browse the repository at this point in the history
Rack implements the Etag header manipulation methods, so we can use
those instead of ours.
  • Loading branch information
tenderlove committed Oct 6, 2015
1 parent 71317e6 commit cddb700
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Expand Up @@ -29,7 +29,7 @@ GIT

GIT
remote: git://github.com/rack/rack.git
revision: c617ea99c12a5bfe026e00476ff37e714e01891a
revision: e2a8388d59bbad0cb867150185770ad76e80d31a
branch: master
specs:
rack (2.0.0.alpha)
Expand Down
8 changes: 2 additions & 6 deletions actionpack/lib/action_dispatch/http/cache.rb
Expand Up @@ -82,19 +82,15 @@ def date=(utc_time)

def etag=(etag)
key = ActiveSupport::Cache.expand_cache_key(etag)
set_header ETAG, %("#{Digest::MD5.hexdigest(key)}")
super %("#{Digest::MD5.hexdigest(key)}")
end

def etag
get_header ETAG
end
alias :etag? :etag
def etag?; etag; end

private

DATE = 'Date'.freeze
LAST_MODIFIED = "Last-Modified".freeze
ETAG = "ETag".freeze
CACHE_CONTROL = "Cache-Control".freeze
SPECIAL_KEYS = Set.new(%w[extras no-cache max-age public must-revalidate])

Expand Down

0 comments on commit cddb700

Please sign in to comment.