From a92f5457e5340c4b75bf71dfbeff1b05a0c180db Mon Sep 17 00:00:00 2001 From: Rupak Ganguly Date: Mon, 15 Apr 2013 17:47:06 -0400 Subject: [PATCH] [hp|network] Add a extra check for responses that return not JSON data. --- lib/fog/hp/network.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/fog/hp/network.rb b/lib/fog/hp/network.rb index 04c031e83..cc40425b1 100644 --- a/lib/fog/hp/network.rb +++ b/lib/fog/hp/network.rb @@ -182,7 +182,11 @@ module Fog end end if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json} - response.body = Fog::JSON.decode(response.body) + if response.body.nil? || response.body == 'null' + response.body = '' + else + response.body = Fog::JSON.decode(response.body) + end end response end