mirror of
https://github.com/github/rails.git
synced 2026-01-30 00:38:00 -05:00
Make sure xml_simple requests don't blow up if an empty request body is recieved
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3936 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -63,11 +63,12 @@ class CGIMethods #:nodoc:
|
||||
when Proc
|
||||
strategy.call(raw_post_data)
|
||||
when :xml_simple
|
||||
typecast_xml_value(XmlSimple.xml_in(raw_post_data,
|
||||
'forcearray' => false,
|
||||
'forcecontent' => true,
|
||||
'keeproot' => true,
|
||||
'contentkey' => '__content__'))
|
||||
raw_post_data.blank? ? nil :
|
||||
typecast_xml_value(XmlSimple.xml_in(raw_post_data,
|
||||
'forcearray' => false,
|
||||
'forcecontent' => true,
|
||||
'keeproot' => true,
|
||||
'contentkey' => '__content__'))
|
||||
when :yaml
|
||||
YAML.load(raw_post_data)
|
||||
when :xml_node
|
||||
|
||||
@@ -92,6 +92,12 @@ class WebServiceTest < Test::Unit::TestCase
|
||||
assert_equal 'content...', @controller.params["summary"]
|
||||
assert_equal 'SimpleXml', @controller.params["title"]
|
||||
end
|
||||
|
||||
def test_use_xml_ximple_with_empty_request
|
||||
ActionController::Base.param_parsers[Mime::XML] = :xml_simple
|
||||
assert_nothing_raised { process('POST', 'application/xml', "") }
|
||||
assert_equal "", @controller.response.body
|
||||
end
|
||||
|
||||
def test_deprecated_request_methods
|
||||
process('POST', 'application/x-yaml')
|
||||
|
||||
Reference in New Issue
Block a user