lib/httparty/parser.rb in httparty-0.8.2 vs lib/httparty/parser.rb in httparty-0.8.3
- old
+ new
@@ -91,11 +91,10 @@
def initialize(body, format)
@body = body
@format = format
end
- private_class_method :new
# @return [Object] the parsed body
# @return [nil] when the response body is nil, an empty string, spaces only or "null"
def parse
return nil if body.nil? || body.strip.empty? || body == "null"
@@ -111,10 +110,15 @@
def xml
MultiXml.parse(body)
end
def json
- MultiJson.decode(body)
+ # https://github.com/sferik/rails/commit/5e62670131dfa1718eaf21ff8dd3371395a5f1cc
+ if MultiJson.respond_to?(:adapter)
+ MultiJson.load(body)
+ else
+ MultiJson.decode(body)
+ end
end
def yaml
YAML.load(body)
end