You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i have established Async Server listening to port, and received JSON data, parse them and then needs to return a response to client by adding headers and route/path to which will yield a successful acknowledgement.
but unfortunately i found arguments in have only (HTTPCODE, "Content-Type", Message), then how can i add client path (example, POST /clientROUTE HTTP/1.1)?
Hello,
i have established Async Server listening to port, and received JSON data, parse them and then needs to return a response to client by adding headers and route/path to which will yield a successful acknowledgement.
but unfortunately i found arguments in have only (HTTPCODE, "Content-Type", Message), then how can i add client path (example, POST /clientROUTE HTTP/1.1)?
here is my main part of code, needs help.
serverWeb.on(
"/",
HTTP_POST,
[](AsyncWebServerRequest * request){},
NULL,
[](AsyncWebServerRequest * request, uint8_t *data, size_t len, size_t index, size_t total) {
for (size_t i = 0; i < len; i++) {
Serial.write(data[i]);
}
char* requestClient = (char ) ps_malloc(101024 * sizeof(char));
sprintf(requestClient,"{"A":"AA","B":%d}",i);
Serial.println(F("send back to Client response"));
AsyncWebServerResponse *response = request->beginResponse(200, "Content-Type: application/json", String(requestClient).c_str());
response->addHeader("header1", "Value1");
response->addHeader("header2", "Value2");
response->addHeader("header3", "Value3");
request->send(response);
});
The text was updated successfully, but these errors were encountered: