1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

do not concatinate params. fixes #452, fixes #453.

This commit is contained in:
Konstantin Haase 2012-03-07 16:51:35 +01:00
parent 318b1a5462
commit e32893491b
2 changed files with 7 additions and 1 deletions

View file

@ -829,7 +829,7 @@ module Sinatra
if values.any?
original, @params = params, params.merge('splat' => [], 'captures' => values)
keys.zip(values) { |k,v| (@params[k] ||= '') << v if v }
keys.zip(values) { |k,v| Array === @params[k] ? @params[k] << v : @params[k] = v if v }
end
catch(:pass) do

View file

@ -236,6 +236,12 @@ class RoutingTest < Test::Unit::TestCase
assert_equal "format=", body
end
it 'does not concatinate params with the same name' do
mock_app { get('/:foo') { params[:foo] } }
get '/a?foo=b'
assert_body 'a'
end
it "supports single splat params like /*" do
mock_app {
get '/*' do