Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 3936

Show
Ignore:
Timestamp:
03/18/06 18:56:19 (3 years ago)
Author:
minam
Message:

Make sure xml_simple requests don't blow up if an empty request body is recieved

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb

    r3915 r3936  
    6464          strategy.call(raw_post_data) 
    6565        when :xml_simple 
    66           typecast_xml_value(XmlSimple.xml_in(raw_post_data, 
    67             'forcearray'   => false, 
    68             'forcecontent' => true, 
    69             'keeproot'     => true, 
    70             'contentkey'   => '__content__')) 
     66          raw_post_data.blank? ? nil : 
     67            typecast_xml_value(XmlSimple.xml_in(raw_post_data, 
     68              'forcearray'   => false, 
     69              'forcecontent' => true, 
     70              'keeproot'     => true, 
     71              'contentkey'   => '__content__')) 
    7172        when :yaml 
    7273          YAML.load(raw_post_data) 
  • trunk/actionpack/test/controller/webservice_test.rb

    r3918 r3936  
    9292    assert_equal 'content...', @controller.params["summary"] 
    9393    assert_equal 'SimpleXml', @controller.params["title"] 
     94  end 
     95 
     96  def test_use_xml_ximple_with_empty_request 
     97    ActionController::Base.param_parsers[Mime::XML] = :xml_simple 
     98    assert_nothing_raised { process('POST', 'application/xml', "") } 
     99    assert_equal "", @controller.response.body 
    94100  end 
    95101