Add the HTTP request body to debug log

This commit is contained in:
Michael Friedrich 2015-11-09 22:48:03 +01:00
parent 9ea51aa86e
commit 36cea68c1a
1 changed files with 7 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#include "remote/httputility.hpp"
#include "base/json.hpp"
#include "base/logger.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -34,8 +35,13 @@ Dictionary::Ptr HttpUtility::FetchRequestParameters(HttpRequest& request)
while ((count = request.ReadBody(buffer, sizeof(buffer))) > 0)
body += String(buffer, buffer + count);
if (!body.IsEmpty())
if (!body.IsEmpty()) {
#ifdef I2_DEBUG
Log(LogDebug, "HttpUtility")
<< "Request body: '" << body << "'";
#endif /* I2_DEBUG */
result = JsonDecode(body);
}
if (!result)
result = new Dictionary();