Permalink
Browse files

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

  • Loading branch information...
1 parent 318b1a5 commit e32893491b6d02c86450a9384732696ce5ba78eb @rkh rkh committed Mar 7, 2012
Showing with 7 additions and 1 deletion.
  1. +1 −1 lib/sinatra/base.rb
  2. +6 −0 test/routing_test.rb
View
@@ -829,7 +829,7 @@ def process_route(pattern, keys, conditions, block = nil, values = [])
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
@@ -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

0 comments on commit e328934

Please sign in to comment.