lib/onering/api.rb in onering-client-0.0.37 vs lib/onering/api.rb in onering-client-0.0.39
- old
+ new
@@ -1,8 +1,8 @@
require 'net/https'
require 'uri'
-require 'json'
+require 'multi_json'
require 'yaml'
require 'addressable/uri'
require 'deep_merge'
module Onering
@@ -96,11 +96,11 @@
end
response = @_http.request(request)
if response.code.to_i >= 400
- rv = (JSON.load(response.body) rescue {}) unless response.body.empty?
+ rv = (MultiJson.load(response.body) rescue {}) unless response.body.empty?
if rv['errors']
msg = "#{rv['errors']['type']}: #{rv['errors']['message']}"
end
@@ -109,10 +109,10 @@
else
raise Errors::ClientError.new("HTTP #{response.code}: #{msg}")
end
else
if response['Content-Type'] == 'application/json'
- rv = (response.body.empty? ? nil : JSON.load(response.body))
+ rv = (response.body.empty? ? nil : MultiJson.load(response.body))
else
rv = response.body
end
end