diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 154e3d0a13..bc7ba87cb1 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -91,7 +91,7 @@ module ActionController end end - path_parameters[key] = value + path_parameters[key.to_sym] = value end end diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb index 0cfe58972f..2a3afbf449 100644 --- a/actionpack/test/controller/test_case_test.rb +++ b/actionpack/test/controller/test_case_test.rb @@ -613,6 +613,12 @@ XML assert_equal({ "bar" => [] }, JSON.load(response.body)["foo"]) end + def test_using_as_json_with_path_parameters + post :test_params, params: { id: "12345" }, as: :json + + assert_equal("12345", @request.path_parameters[:id]) + end + def test_mutating_content_type_headers_for_plain_text_files_sets_the_header @request.headers["Content-Type"] = "text/plain" post :render_body, params: { name: "foo.txt" }