fix: data output via web server on ESP32 fixed

This commit is contained in:
Yurii
2024-01-18 23:37:12 +03:00
parent 5e3751ca03
commit 99088fb723
5 changed files with 29 additions and 26 deletions

View File

@@ -16,18 +16,21 @@ public:
this->webServer->send(505, F("text/html"), F("HTTP1.1 required"));
return;
}
#else
this->webServer->send(code, contentType, "");
#endif
this->webServer->setContentLength(measureJson(content));
#else
this->webServer->setContentLength(CONTENT_LENGTH_UNKNOWN);
this->webServer->sendHeader(F("Content-Length"), String(measureJson(content)));
this->webServer->send(code, contentType, emptyString);
#endif
serializeJson(content, *this);
this->flush();
#ifdef ARDUINO_ARCH_ESP8266
this->webServer->chunkedResponseFinalize();
#else
this->webServer->sendContent("");
this->webServer->sendContent(emptyString);
#endif
}

View File

@@ -72,7 +72,8 @@ public:
return true;
}
#else
server.send(200, F("text/html"), "");
server.setContentLength(CONTENT_LENGTH_UNKNOWN);
server.send(200, "text/html", emptyString);
#endif
uint8_t* argStartPos = nullptr;
@@ -209,7 +210,7 @@ public:
#ifdef ARDUINO_ARCH_ESP8266
server.chunkedResponseFinalize();
#else
server.sendContent("");
server.sendContent(emptyString);
#endif
return true;