mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
delete empty response
This commit is contained in:
@@ -103,10 +103,11 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject & input) {
|
|||||||
// output json buffer
|
// output json buffer
|
||||||
auto * response = new PrettyAsyncJsonResponse(false, EMSESP_JSON_SIZE_XXLARGE_DYN);
|
auto * response = new PrettyAsyncJsonResponse(false, EMSESP_JSON_SIZE_XXLARGE_DYN);
|
||||||
if (!response->getSize()) {
|
if (!response->getSize()) {
|
||||||
|
delete response;
|
||||||
response = new PrettyAsyncJsonResponse(false, 256);
|
response = new PrettyAsyncJsonResponse(false, 256);
|
||||||
response->setCode(507);
|
response->setCode(507); // Insufficient Storage
|
||||||
response->setLength();
|
response->setLength();
|
||||||
request->send(response); // Insufficient Storage
|
request->send(response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JsonObject output = response->getRoot();
|
JsonObject output = response->getRoot();
|
||||||
|
|||||||
@@ -202,10 +202,11 @@ void WebCustomizationService::device_entities(AsyncWebServerRequest * request, J
|
|||||||
if (json.is<JsonObject>()) {
|
if (json.is<JsonObject>()) {
|
||||||
auto * response = new MsgpackAsyncJsonResponse(true, EMSESP_JSON_SIZE_XXXLARGE_DYN);
|
auto * response = new MsgpackAsyncJsonResponse(true, EMSESP_JSON_SIZE_XXXLARGE_DYN);
|
||||||
if (!response->getSize()) {
|
if (!response->getSize()) {
|
||||||
|
delete response;
|
||||||
response = new MsgpackAsyncJsonResponse(true, 256);
|
response = new MsgpackAsyncJsonResponse(true, 256);
|
||||||
response->setCode(507);
|
response->setCode(507); // Insufficient Storage
|
||||||
response->setLength();
|
response->setLength();
|
||||||
request->send(response); // Insufficient Storage
|
request->send(response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
|
|||||||
@@ -167,11 +167,11 @@ void WebDataService::device_data(AsyncWebServerRequest * request, JsonVariant &
|
|||||||
if (json.is<JsonObject>()) {
|
if (json.is<JsonObject>()) {
|
||||||
auto * response = new MsgpackAsyncJsonResponse(false, EMSESP_JSON_SIZE_XXXLARGE_DYN);
|
auto * response = new MsgpackAsyncJsonResponse(false, EMSESP_JSON_SIZE_XXXLARGE_DYN);
|
||||||
if (!response->getSize()) {
|
if (!response->getSize()) {
|
||||||
// EMSESP::logger().err("Insufficient storage");
|
delete response;
|
||||||
response = new MsgpackAsyncJsonResponse(false, 256);
|
response = new MsgpackAsyncJsonResponse(false, 256);
|
||||||
response->setCode(507);
|
response->setCode(507); // Insufficient Storage
|
||||||
response->setLength();
|
response->setLength();
|
||||||
request->send(response); // Insufficient Storage (507)
|
request->send(response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
|
|||||||
Reference in New Issue
Block a user