test/spec_utils.rb in rack-1.6.1 vs test/spec_utils.rb in rack-1.6.2
- old
+ new
@@ -132,9 +132,21 @@
lambda {
params.to_params_hash.to_s.should.equal ex.to_s
}.should.not.raise
end
+ should "raise an exception if the params are too deep" do
+ len = Rack::Utils.param_depth_limit
+
+ lambda {
+ Rack::Utils.parse_nested_query("foo#{"[a]" * len}=bar")
+ }.should.raise(RangeError)
+
+ lambda {
+ Rack::Utils.parse_nested_query("foo#{"[a]" * (len - 1)}=bar")
+ }.should.not.raise
+ end
+
should "parse nested query strings correctly" do
Rack::Utils.parse_nested_query("foo").
should.equal "foo" => nil
Rack::Utils.parse_nested_query("foo=").
should.equal "foo" => ""