1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

remove dependency on @cache_control ivar

eventually we'll remove this instance variable, but this is the first
step
This commit is contained in:
Aaron Patterson 2015-08-27 12:09:04 -07:00
parent 53265e8806
commit d05d7e23d1

View file

@ -131,7 +131,7 @@ module ActionDispatch
def handle_conditional_get!
if etag? || last_modified? || !@cache_control.empty?
set_conditional_cache_control!
set_conditional_cache_control!(@cache_control)
end
end
@ -141,17 +141,17 @@ module ActionDispatch
PRIVATE = "private".freeze
MUST_REVALIDATE = "must-revalidate".freeze
def set_conditional_cache_control!
def set_conditional_cache_control!(cache_control)
control = {}
cc_headers = cache_control_headers
if extras = cc_headers.delete(:extras)
@cache_control[:extras] ||= []
@cache_control[:extras] += extras
@cache_control[:extras].uniq!
cache_control[:extras] ||= []
cache_control[:extras] += extras
cache_control[:extras].uniq!
end
control.merge! cc_headers
control.merge! @cache_control
control.merge! cache_control
if control.empty?
set_header CACHE_CONTROL, DEFAULT_CACHE_CONTROL