lib/lumberg/format_whm.rb in lumberg-3.0.0 vs lib/lumberg/format_whm.rb in lumberg-3.1.0

- old
+ new

@@ -24,10 +24,18 @@ Zlib::Inflate.inflate(env[:body]) else env[:body] end - env[:body] = format_response body + if body =~ /cPanel operations have been temporarily suspended/ + raise Lumberg::WhmConnectionError.new(body) + end + + if @type == :whostmgr || response_type(body) == :whostmgr + env[:body] = format_response body + else + env[:body] = format_response JSON.parse(body) + end end def response_values(env) {status: env[:status], headers: env[:response_headers], body: env[:body]} end