remove @etag ivar

we're storing the value in the headers hash, so lets just store the
value in one place.
This commit is contained in:
Aaron Patterson 2015-08-27 12:02:33 -07:00
parent 4e88f4f808
commit 53265e8806

@ -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,10 +83,14 @@ 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
DATE = 'Date'.freeze
@ -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!