Skip to content

Commit f5ea5e6

Browse files
committed
feat: get body only from the response.
1 parent 82dbaee commit f5ea5e6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lib/rest/httpRequestSend.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,13 @@ static int contentLenParse(char* s)
214214
}
215215

216216

217+
std::string get_body(const std::string &raw) {
218+
const size_t start = raw.find("{");
219+
const size_t end = raw.rfind("}");
220+
if (start == std::string::npos || end == std::string::npos) return "";
221+
return raw.substr(start, end - start + 1);
222+
}
223+
217224

218225
/* ****************************************************************************
219226
*
@@ -659,7 +666,7 @@ int httpRequestSend
659666
else
660667
{
661668
LM_W(("Notification (%s) response NOT OK, http code: %d, response body: %s",
662-
idStringForLogs.c_str(), *statusCodeP, outP->c_str()));
669+
idStringForLogs.c_str(), *statusCodeP, get_body(httpResponse->memory).c_str()));
663670
}
664671
}
665672

0 commit comments

Comments
 (0)