]> granicus.if.org Git - icinga2/commitdiff
Check for verbose error handling in SendJsonError()
authorMichael Friedrich <michael.friedrich@icinga.com>
Thu, 5 Apr 2018 15:17:06 +0000 (17:17 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Thu, 5 Apr 2018 15:17:06 +0000 (17:17 +0200)
lib/remote/httputility.cpp

index 7b0fa8e3cf5c864a5a7de13dd8b18dab0e79b31f..2788a03b20699d5520ebae6159fe3f15fab04320 100644 (file)
@@ -89,11 +89,18 @@ void HttpUtility::SendJsonError(HttpResponse& response, const Dictionary::Ptr& p
        response.SetStatus(code, HttpUtility::GetErrorNameByCode(code));
        result->Set("error", code);
 
+       bool verbose = false;
+
+       if (params)
+               verbose = HttpUtility::GetLastParameter(params, "verbose");
+
        if (!info.IsEmpty())
                result->Set("status", info);
 
-       if (!diagnosticInformation.IsEmpty())
-               result->Set("diagnostic information", diagnosticInformation);
+       if (verbose) {
+               if (!diagnosticInformation.IsEmpty())
+                       result->Set("diagnostic_information", diagnosticInformation);
+       }
 
        HttpUtility::SendJsonBody(response, params, result);
 }