Skip to content

Commit 65b3c06

Browse files
committed
add a (latest) rack-compatibility spec in params parsing
1 parent c23a1a4 commit 65b3c06

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/spec/ruby/rack/handler/servlet_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,26 @@ def servlet.create_env(servlet_env)
969969
rack_request.request_method.should == 'PUT'
970970
end
971971

972+
it "does not truncate query strings containing semi-colons (Rack-compat)" do
973+
servlet_request.setMethod 'GET'
974+
servlet_request.setContextPath '/'
975+
servlet_request.setPathInfo '/path'
976+
servlet_request.setRequestURI '/home/path'
977+
servlet_request.setQueryString 'foo=bar&quux=b;la'
978+
# Query params :
979+
servlet_request.addParameter('foo', 'bar')
980+
servlet_request.addParameter('quux', 'b;la')
981+
982+
env = servlet.create_env(servlet_env)
983+
rack_request = Rack::Request.new(env)
984+
985+
rack_request.GET.should == { "foo" => "bar", "quux" => "b;la" }
986+
rack_request.POST.should == {}
987+
rack_request.params.should == { "foo" => "bar", "quux" => "b;la" }
988+
989+
rack_request.query_string.should == 'foo=bar&quux=b;la'
990+
end
991+
972992
it "sets cookies from servlet requests" do
973993
cookies = []
974994
cookies << javax.servlet.http.Cookie.new('foo', 'bar')

0 commit comments

Comments
 (0)