lib/flexirest/request.rb in flexirest-1.3.7 vs lib/flexirest/request.rb in flexirest-1.3.8

- old
+ new

@@ -552,13 +552,15 @@ elsif options[:ignore_xml_root] Flexirest::Logger.warn("Using `ignore_xml_root` is deprecated, please switch to `ignore_root`") body = body[options[:ignore_xml_root].to_s] end end - body = begin - @method[:name].nil? ? body : translator.send(@method[:name], body) - rescue NoMethodError - body + if translator + body = begin + @method[:name].nil? ? body : translator.send(@method[:name], body) + rescue NoMethodError + body + end end if body.is_a? Array result = Flexirest::ResultIterator.new(@response) body.each do |json_object| result << new_object(json_object, @overridden_name)