From b3979057701519e5239562f32ae0c0551f9baeef Mon Sep 17 00:00:00 2001 From: Mike Pastore Date: Wed, 10 Feb 2016 14:03:13 -0600 Subject: [PATCH] Fix s-maxage and value coercion --- lib/sinatra/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 7f182e2907..a08d2db75f 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -446,7 +446,7 @@ def stream(keep_open = false) # Specify response freshness policy for HTTP caches (Cache-Control header). # Any number of non-value directives (:public, :private, :no_cache, # :no_store, :must_revalidate, :proxy_revalidate) may be passed along with - # a Hash of value directives (:max_age, :min_stale, :s_max_age). + # a Hash of value directives (:max_age, :min_stale, :s_maxage). # # cache_control :public, :must_revalidate, :max_age => 60 # => Cache-Control: public, must-revalidate, max-age=60 @@ -465,7 +465,7 @@ def cache_control(*values) values.map! { |value| value.to_s.tr('_','-') } hash.each do |key, value| key = key.to_s.tr('_', '-') - value = value.to_i if key == "max-age" + value = value.to_i if ['max-age', 's-maxage'].include? key values << "#{key}=#{value}" end