Skip to content

Commit

Permalink
small improvment of output performance
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinVerges committed Jun 19, 2022
1 parent 3657247 commit f834697
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions wifimanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,14 +634,14 @@ void WIFIMANAGER::attachWebServer(WebServer * srv) {
}
}
#if ASYNC_WEBSERVER == true
serializeJson(jsonDoc, *response);
serializeJson(jsonDoc.to<JsonArray>(), *response);
response->setCode(200);
response->setContentLength(measureJson(jsonDoc));
request->send(response);
#else
// Improve me: not that efficient without the stream response
serializeJson(jsonDoc, buffer);
webServer->send(200, "application/json", buffer.c_str());
serializeJson(jsonDoc.to<JsonArray>(), buffer);
webServer->send(200, "application/json", (buffer.equals("null") ? "{}" : buffer));
#endif
});

Expand Down Expand Up @@ -686,7 +686,7 @@ void WIFIMANAGER::attachWebServer(WebServer * srv) {
#else
// Improve me: not that efficient without the stream response
serializeJson(jsonDoc, buffer);
webServer->send(200, "application/json", buffer.c_str());
webServer->send(200, "application/json", buffer);
#endif
});

Expand Down Expand Up @@ -723,7 +723,7 @@ void WIFIMANAGER::attachWebServer(WebServer * srv) {
#else
// Improve me: not that efficient without the stream response
serializeJson(jsonDoc, buffer);
webServer->send(200, "application/json", buffer.c_str());
webServer->send(200, "application/json", buffer);
#endif
});
}

0 comments on commit f834697

Please sign in to comment.