Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

request.parameters doesn't overwrite request.request_parameters. Closes

#9949 [nullstyle]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7992 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 79670fb9753693993f5c2f42e5b3d39e51ab4f43 1 parent f777ff7
@jeremy jeremy authored
View
2  actionpack/lib/action_controller/request.rb
@@ -275,7 +275,7 @@ def raw_post
# Returns both GET and POST parameters in a single hash.
def parameters
- @parameters ||= request_parameters.update(query_parameters).update(path_parameters).with_indifferent_access
+ @parameters ||= request_parameters.merge(query_parameters).update(path_parameters).with_indifferent_access
end
def path_parameters=(parameters) #:nodoc:
View
9 actionpack/test/controller/request_test.rb
@@ -355,6 +355,15 @@ def test_content_type_with_charset
def test_user_agent
assert_not_nil @request.user_agent
end
+
+ def test_parameters
+ @request.instance_eval { @request_parameters = { "foo" => 1 } }
+ @request.instance_eval { @query_parameters = { "bar" => 2 } }
+
+ assert_equal({"foo" => 1, "bar" => 2}, @request.parameters)
+ assert_equal({"foo" => 1}, @request.request_parameters)
+ assert_equal({"bar" => 2}, @request.query_parameters)
+ end
protected
def set_request_method_to(method)
View
4 actionpack/test/controller/test_test.rb
@@ -108,7 +108,7 @@ def teardown
def test_raw_post_handling
params = {:page => {:name => 'page name'}, 'some key' => 123}
- get :render_raw_post, params.dup
+ post :render_raw_post, params.dup
assert_equal params.to_query, @response.body
end
@@ -116,7 +116,7 @@ def test_raw_post_handling
def test_body_stream
params = { :page => { :name => 'page name' }, 'some key' => 123 }
- get :render_body, params.dup
+ post :render_body, params.dup
assert_equal params.to_query, @response.body
end
Please sign in to comment.
Something went wrong with that request. Please try again.