From c6d5a8ceab36fa48881e722a4a9a328f74530e7b Mon Sep 17 00:00:00 2001 From: Boris Staal Date: Mon, 30 Sep 2013 01:34:12 +0700 Subject: [PATCH] Rails4-compatible raw body accessor (fixes #118) --- lib/wash_out/dispatcher.rb | 2 +- spec/lib/wash_out/dispatcher_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/wash_out/dispatcher.rb b/lib/wash_out/dispatcher.rb index 06749e30..8d04f2b7 100644 --- a/lib/wash_out/dispatcher.rb +++ b/lib/wash_out/dispatcher.rb @@ -19,7 +19,7 @@ def _parse_soap_parameters :advanced_typecasting => true, :convert_tags_to => ( soap_config.snakecase_input ? lambda { |tag| tag.snakecase.to_sym } : lambda { |tag| tag.to_sym } )) - @_params = nori_parser.parse(request.body.read) + @_params = nori_parser.parse(request.raw_post) references = WashOut::Dispatcher.deep_select(@_params){|k,v| v.is_a?(Hash) && v.has_key?(:@id)} unless references.blank? diff --git a/spec/lib/wash_out/dispatcher_spec.rb b/spec/lib/wash_out/dispatcher_spec.rb index 69dab1e0..c9b8465d 100644 --- a/spec/lib/wash_out/dispatcher_spec.rb +++ b/spec/lib/wash_out/dispatcher_spec.rb @@ -9,7 +9,7 @@ class Dispatcher < ApplicationController def self.mock(text="") dispatcher = self.new - dispatcher.request = OpenStruct.new(:body => OpenStruct.new(:read => text)) + dispatcher.request = OpenStruct.new(:raw_post => text) dispatcher end