Skip to content

Commit

Permalink
Merge pull request #1096 from mwpastore/fix-s-maxage
Browse files Browse the repository at this point in the history
Fix s-maxage and value coercion
  • Loading branch information
kgrz committed Feb 25, 2016
2 parents df19c7d + b397905 commit 4c7d38e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/sinatra/base.rb
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 4c7d38e

Please sign in to comment.