diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-09-18 14:32:20 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-09-18 14:32:20 -0700 |
commit | b8b7664415f9d6668156280a8ed051dc04786115 (patch) | |
tree | 57c574f50eeb29add626bfa2c5eed0f495a4eda6 | |
parent | 05b08f295251583cb6ac51ed0075e5d77fdd830c (diff) | |
download | rails-b8b7664415f9d6668156280a8ed051dc04786115.tar.gz rails-b8b7664415f9d6668156280a8ed051dc04786115.tar.bz2 rails-b8b7664415f9d6668156280a8ed051dc04786115.zip |
let the request object handle parsing XML posts
The test request object will handle parsing XML posts now, so we don't
need to eagerly parse them in the test harness
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index c2f07b2373..c360cfd542 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -33,6 +33,9 @@ module ActionController self.session = session self.session_options = TestSession::DEFAULT_OPTIONS + @custom_param_parsers = { + Mime::XML => lambda { |raw_post| Hash.from_xml(raw_post)['hash'] } + } end def query_string=(string) @@ -85,8 +88,6 @@ module ActionController data = ActiveSupport::JSON.encode(non_path_parameters) when :xml data = non_path_parameters.to_xml - params = Hash.from_xml(data)['hash'] - self.request_parameters = params when :url_encoded_form data = non_path_parameters.to_query else @@ -134,6 +135,12 @@ module ActionController "multipart/form-data; boundary=#{Rack::Test::MULTIPART_BOUNDARY}" end end.new + + private + + def params_parsers + super.merge @custom_param_parsers + end end class LiveTestResponse < Live::Response |