[hp|network] Add a extra check for responses that return not JSON data.

This commit is contained in:
Rupak Ganguly 2013-04-15 17:47:06 -04:00
parent fc7345886a
commit a92f5457e5
1 changed files with 5 additions and 1 deletions

View File

@ -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