From 1dd8409691810152d548c4e11f125b4bcf24f448 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 5 Apr 2018 17:17:06 +0200 Subject: [PATCH] Check for verbose error handling in SendJsonError() --- lib/remote/httputility.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/remote/httputility.cpp b/lib/remote/httputility.cpp index 7b0fa8e3c..2788a03b2 100644 --- a/lib/remote/httputility.cpp +++ b/lib/remote/httputility.cpp @@ -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); } -- 2.40.0