lib/onering/api.rb in onering-client-0.0.15 vs lib/onering/api.rb in onering-client-0.0.16

- old
+ new

@@ -59,11 +59,11 @@ end response = @_http.request(request) if response.code.to_i >= 400 - rv = JSON.load(response.body) + rv = JSON.load(response.body) unless response.body.empty? if rv['errors'] msg = "#{rv['errors']['type']}: #{rv['errors']['message']}" end @@ -72,10 +72,10 @@ else raise Errors::ClientError.new("HTTP #{response.code}: #{msg}") end else if response['Content-Type'] == 'application/json' - rv = JSON.load(response.body) + rv = (response.body.empty? ? nil : JSON.load(response.body)) else rv = response.body end end