diff --git a/actionpack/lib/action_dispatch/http/cache.rb b/actionpack/lib/action_dispatch/http/cache.rb index 8dc693c8ae7b50df84d50cc123e9de11d193cc01..c6ea6d8e0136325b6be2df3964f453217fa6685b 100644 --- a/actionpack/lib/action_dispatch/http/cache.rb +++ b/actionpack/lib/action_dispatch/http/cache.rb @@ -51,8 +51,7 @@ def fresh?(response) end module Response - attr_reader :cache_control, :etag - alias :etag? :etag + attr_reader :cache_control def last_modified if last = get_header(LAST_MODIFIED) @@ -84,9 +83,13 @@ def date=(utc_time) def etag=(etag) key = ActiveSupport::Cache.expand_cache_key(etag) - @etag = %("#{Digest::MD5.hexdigest(key)}") - set_header ETAG, @etag + set_header ETAG, %("#{Digest::MD5.hexdigest(key)}") + end + + def etag + get_header ETAG end + alias :etag? :etag private @@ -124,7 +127,6 @@ def cache_control_headers def prepare_cache_control! @cache_control = cache_control_headers - @etag = get_header ETAG end def handle_conditional_get!