Allow ampersands in URL parameters, fixes GH #37.
This commit is contained in:
parent
12c11578f5
commit
2233cdbf68
|
@ -932,7 +932,7 @@ module Sinatra
|
|||
Regexp.escape(match)
|
||||
else
|
||||
keys << $2[1..-1]
|
||||
"([^/?&#]+)"
|
||||
"([^/?#]+)"
|
||||
end
|
||||
end
|
||||
[/^#{pattern}$/, keys]
|
||||
|
|
|
@ -356,6 +356,18 @@ class RoutingTest < Test::Unit::TestCase
|
|||
assert_equal 'looks good', body
|
||||
end
|
||||
|
||||
it "matches paths that include ampersands" do
|
||||
mock_app {
|
||||
get '/:name' do
|
||||
'looks good'
|
||||
end
|
||||
}
|
||||
|
||||
get '/foo&bar'
|
||||
assert ok?
|
||||
assert_equal 'looks good', body
|
||||
end
|
||||
|
||||
it "URL decodes named parameters and splats" do
|
||||
mock_app {
|
||||
get '/:foo/*' do
|
||||
|
|
Loading…
Reference in New Issue