提交 3957d44f 编写于 作者: J Jeremy Kemper

Use request.body IO and rewind, if possible

上级 08639249
......@@ -36,11 +36,14 @@ def parse_formatted_parameters(env)
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 @@ def logger
defined?(Rails.logger) ? Rails.logger : Logger.new($stderr)
end
end
end
\ No newline at end of file
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册