aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-05-09 11:46:45 +0200
committerXavier Noria <fxn@hashref.com>2010-05-09 11:46:45 +0200
commite1a0d86fe0355ddff8c86db0f42f3824ffe14c02 (patch)
tree5833022ca41905f243c15c8a5ffdf864de69bfa6 /actionpack
parent1ff3d951e620ddeeb97e87e2024391470e886467 (diff)
parentdf508bd97062b871fe25eda8d1bb61cd43d79bc4 (diff)
downloadrails-e1a0d86fe0355ddff8c86db0f42f3824ffe14c02.tar.gz
rails-e1a0d86fe0355ddff8c86db0f42f3824ffe14c02.tar.bz2
rails-e1a0d86fe0355ddff8c86db0f42f3824ffe14c02.zip
Merge remote branch 'rails/master'
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/middleware/params_parser.rb2
-rw-r--r--actionpack/test/dispatch/request/xml_params_parsing_test.rb13
2 files changed, 14 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb
index a25089176c..d4208ca96e 100644
--- a/actionpack/lib/action_dispatch/middleware/params_parser.rb
+++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb
@@ -38,7 +38,7 @@ module ActionDispatch
when Proc
strategy.call(request.raw_post)
when :xml_simple, :xml_node
- data = Hash.from_xml(request.body) || {}
+ data = Hash.from_xml(request.body.read) || {}
request.body.rewind if request.body.respond_to?(:rewind)
data.with_indifferent_access
when :yaml
diff --git a/actionpack/test/dispatch/request/xml_params_parsing_test.rb b/actionpack/test/dispatch/request/xml_params_parsing_test.rb
index 488799ac2a..f2ce2c5b93 100644
--- a/actionpack/test/dispatch/request/xml_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/xml_params_parsing_test.rb
@@ -16,6 +16,19 @@ class XmlParamsParsingTest < ActionController::IntegrationTest
TestController.last_request_parameters = nil
end
+ test "parses a strict rack.input" do
+ class Linted
+ def call(env)
+ bar = env['action_dispatch.request.request_parameters']['foo']
+ result = "<ok>#{bar}</ok>"
+ [200, {"Content-Type" => "application/xml", "Content-Length" => result.length.to_s}, result]
+ end
+ end
+ req = Rack::MockRequest.new(ActionDispatch::ParamsParser.new(Linted.new))
+ resp = req.post('/', "CONTENT_TYPE" => "application/xml", :input => "<foo>bar</foo>", :lint => true)
+ assert_equal "<ok>bar</ok>", resp.body
+ end
+
test "parses hash params" do
with_test_routing do
xml = "<person><name>David</name></person>"