fix standalone

This commit is contained in:
proddy
2025-11-20 15:21:38 +01:00
parent 3a508a3ec4
commit c9bddba446

View File

@@ -156,19 +156,13 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject input) {
// serialize JSON to string to ensure correct content-length and avoid HTTP parsing errors (issue #2752) // serialize JSON to string to ensure correct content-length and avoid HTTP parsing errors (issue #2752)
std::string output_str; std::string output_str;
serializeJson(output, output_str); serializeJson(output, output_str);
request->send(ret_codes[return_code], "application/json; charset=utf-8", output_str.c_str()); request->send(ret_codes[return_code], "application/json; charset=utf-8", output_str.c_str());
api_count_++;
delete response;
#if defined(EMSESP_UNITY) #if defined(EMSESP_UNITY)
// store the result so we can test with Unity later // store the result so we can test with Unity later
storeResponse(output); storeResponse(output);
#endif #endif
#if defined(EMSESP_STANDALONE) && !defined(EMSESP_UNITY) #if defined(EMSESP_STANDALONE) && !defined(EMSESP_UNITY)
std::string output_str;
serializeJson(output, output_str);
Serial.printf("%sweb output: %s[%s] %s(%d)%s %s%s", Serial.printf("%sweb output: %s[%s] %s(%d)%s %s%s",
COLOR_WHITE, COLOR_WHITE,
COLOR_BRIGHT_CYAN, COLOR_BRIGHT_CYAN,
@@ -181,6 +175,9 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject input) {
Serial.println(); Serial.println();
EMSESP::logger().debug("web output: %s %s", request->url().c_str(), output_str.c_str()); EMSESP::logger().debug("web output: %s %s", request->url().c_str(), output_str.c_str());
#endif #endif
api_count_++;
delete response;
} }
#if defined(EMSESP_UNITY) #if defined(EMSESP_UNITY)