diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index e7b930eed797c..a810352279e0e 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -391,6 +391,20 @@ def session_options=(options) Session::Options.set self, options end + if Rack.release >= "3" + class QueryParser < ::Rack::QueryParser + def missing_value + nil + end + end + + QUERY_PARSER = QueryParser.make_default(32) + + def query_parser + QUERY_PARSER + end + end + # Override Rack's GET method to support indifferent access. def GET fetch_header("action_dispatch.request.query_parameters") do |k| diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb index 8d18dbb2050a1..4a83f88627872 100644 --- a/actionpack/test/controller/test_case_test.rb +++ b/actionpack/test/controller/test_case_test.rb @@ -261,7 +261,7 @@ def to_param def test_body_stream params = Hash[:page, { name: "page name" }, "some key", 123] - post :render_body, params: params.dup + post :render_body, body: params.to_query assert_equal params.to_query, @response.body end diff --git a/actionpack/test/dispatch/request/query_string_parsing_test.rb b/actionpack/test/dispatch/request/query_string_parsing_test.rb index 45fb5cb8604ae..7bdcb892f766d 100644 --- a/actionpack/test/dispatch/request/query_string_parsing_test.rb +++ b/actionpack/test/dispatch/request/query_string_parsing_test.rb @@ -168,7 +168,7 @@ def assert_parses(expected, actual) middleware.use(EarlyParse) end - get "/parse", params: actual + get "/parse?#{actual}" assert_response :ok assert_equal(expected, ::QueryStringParsingTest::TestController.last_query_parameters) end