aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2010-04-07 11:42:07 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2010-04-07 11:42:07 -0700
commit3957d44fd10c683518562f22d8b73f1b1c3d455d (patch)
tree863211de5176f5f0db12ab11fd817535eb9e7a65 /actionpack/lib
parent086392492cdf546713122c6ef1601e45fdf2142f (diff)
downloadrails-3957d44fd10c683518562f22d8b73f1b1c3d455d.tar.gz
rails-3957d44fd10c683518562f22d8b73f1b1c3d455d.tar.bz2
rails-3957d44fd10c683518562f22d8b73f1b1c3d455d.zip
Use request.body IO and rewind, if possible
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/middleware/params_parser.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb
index c0efdae2a0..1524b00d5b 100644
--- a/actionpack/lib/action_dispatch/middleware/params_parser.rb
+++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb
@@ -36,11 +36,14 @@ module ActionDispatch
when Proc
strategy.call(request.raw_post)
when :xml_simple, :xml_node
- (Hash.from_xml(request.raw_post) || {}).with_indifferent_access
+ data = Hash.from_xml(request.body) || {}
+ request.body.rewind if request.body.respond_to?(:rewind)
+ data.with_indifferent_access
when :yaml
YAML.load(request.raw_post)
when :json
- data = ActiveSupport::JSON.decode(request.raw_post)
+ data = ActiveSupport::JSON.decode(request.body)
+ request.body.rewind if request.body.respond_to?(:rewind)
data = {:_json => data} unless data.is_a?(Hash)
data.with_indifferent_access
else
@@ -72,4 +75,4 @@ module ActionDispatch
defined?(Rails.logger) ? Rails.logger : Logger.new($stderr)
end
end
-end \ No newline at end of file
+end