test/spec_request.rb in rack-1.4.0 vs test/spec_request.rb in rack-1.4.1
- old
+ new
@@ -135,9 +135,22 @@
ensure
Rack::Utils.key_space_limit = old
end
end
+ should "limit the key size per nested params hash" do
+ nested_query = Rack::MockRequest.env_for("/?foo[bar][baz][qux]=1")
+ plain_query = Rack::MockRequest.env_for("/?foo_bar__baz__qux_=1")
+
+ old, Rack::Utils.key_space_limit = Rack::Utils.key_space_limit, 3
+ begin
+ lambda { Rack::Request.new(nested_query).GET }.should.not.raise(RangeError)
+ lambda { Rack::Request.new(plain_query).GET }.should.raise(RangeError)
+ ensure
+ Rack::Utils.key_space_limit = old
+ end
+ end
+
should "not unify GET and POST when calling params" do
mr = Rack::MockRequest.env_for("/?foo=quux",
"REQUEST_METHOD" => 'POST',
:input => "foo=bar&quux=bla"
)