Path parameter keys should always be symbols.
If request format is JSON, keys are converted to Strings, so we have to convert them to Symbols.
This commit is contained in:
parent
a9336a67b0
commit
5b6aa8c20a
|
@ -91,7 +91,7 @@ module ActionController
|
|||
end
|
||||
end
|
||||
|
||||
path_parameters[key] = value
|
||||
path_parameters[key.to_sym] = value
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -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" }
|
||||
|
|
Loading…
Reference in New Issue