Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/http/HttpResponseDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ namespace MAT_NS_BEGIN {
try
{
std::string body(response.GetBody().begin(), response.GetBody().end());

// Validate that the body is valid JSON before attempting to parse
if (body.empty() || !nlohmann::json::accept(body))
{
LOG_ERROR("HTTP response: body is not valid JSON, skipping processing");
return;
}

responseBody = nlohmann::json::parse(body.c_str());
int accepted = 0;
auto acc = responseBody.find("acc");
Expand Down
Loading