bringing back the string.
Symbols are not garbage collected and I don't want to use the large (but cool) HashWithIndifferentAccess. I could use OpenStruct ala camping but that seems unnecessary. Long live the string.
This commit is contained in:
parent
1bcd28fa13
commit
be5f5270ec
|
@ -149,7 +149,7 @@ module Sinatra
|
|||
@param_keys = []
|
||||
@options = options
|
||||
regex = @path.to_s.gsub(PARAM) do
|
||||
@param_keys << $1.intern
|
||||
@param_keys << $1
|
||||
"(#{URI_CHAR}+)"
|
||||
end
|
||||
|
||||
|
@ -586,7 +586,7 @@ module Sinatra
|
|||
end
|
||||
|
||||
def params
|
||||
@params ||= @route_params.merge(@request.params).symbolize_keys
|
||||
@params = @route_params.merge(@request.params)
|
||||
end
|
||||
|
||||
def stop(*args)
|
||||
|
|
|
@ -18,7 +18,7 @@ context "Sinatra" do
|
|||
|
||||
specify "handles events" do
|
||||
get '/:name' do
|
||||
'Hello ' + params[:name]
|
||||
'Hello ' + params["name"]
|
||||
end
|
||||
|
||||
get_it '/Blake'
|
||||
|
|
|
@ -42,7 +42,7 @@ context "Looking up a request" do
|
|||
|
||||
result.should.not.be.nil
|
||||
result.block.should.be block
|
||||
result.params.should.equal :foo => 'bar'
|
||||
result.params.should.equal "foo" => 'bar'
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -120,7 +120,7 @@ context "Events in an app" do
|
|||
|
||||
specify "get access to request, response, and params" do
|
||||
get '/:foo' do
|
||||
params[:foo] + params[:bar]
|
||||
params["foo"] + params["bar"]
|
||||
end
|
||||
|
||||
get_it '/foo?bar=baz'
|
||||
|
|
|
@ -28,12 +28,12 @@ context "Simple Events" do
|
|||
specify "takes params in path" do
|
||||
result = invoke_simple('/:foo/:bar', '/a/b')
|
||||
result.should.not.be.nil
|
||||
result.params.should.equal :foo => 'a', :bar => 'b'
|
||||
result.params.should.equal "foo" => 'a', "bar" => 'b'
|
||||
|
||||
# unscapes
|
||||
result = invoke_simple('/:foo/:bar', '/a/blake%20mizerany')
|
||||
result.should.not.be.nil
|
||||
result.params.should.equal :foo => 'a', :bar => 'blake mizerany'
|
||||
result.params.should.equal "foo" => 'a', "bar" => 'blake mizerany'
|
||||
end
|
||||
|
||||
specify "ignores to many /'s" do
|
||||
|
|
Loading…
Reference in New Issue