Make sure max-age is an integer (as specified by RFC2616). Fixes #106.
This commit is contained in:
parent
ad648be044
commit
1bee791e5b
|
@ -264,7 +264,11 @@ module Sinatra
|
|||
end
|
||||
|
||||
values = values.map { |value| value.to_s.tr('_','-') }
|
||||
hash.each { |k,v| values << [k.to_s.tr('_', '-'), v].join('=') }
|
||||
hash.each do |key, value|
|
||||
key = key.to_s.tr('_', '-')
|
||||
value = value.to_i if key == "max-age"
|
||||
values << [key, value].join('=')
|
||||
end
|
||||
|
||||
response['Cache-Control'] = values.join(', ') if values.any?
|
||||
end
|
||||
|
|
|
@ -426,7 +426,7 @@ class HelpersTest < Test::Unit::TestCase
|
|||
setup do
|
||||
mock_app {
|
||||
get '/' do
|
||||
cache_control :public, :no_cache, :max_age => 60
|
||||
cache_control :public, :no_cache, :max_age => 60.0
|
||||
'Hello World'
|
||||
end
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue