forked from me-no-dev/ESPAsyncWebServer
- Notifications
You must be signed in to change notification settings - Fork 65
Closed
Labels
Description
Platform
ESP32
IDE / Tooling
Arduino (IDE/CLI)
What happened?
I have tried to use this syntax
server.on("/testJsonPost", HTTP_POST, [](AsyncWebServerRequest *request, JsonVariant &json) { // handle the json request... });
Why do I have to create a separate handler for it?
This is ridiculusly long.
auto *testPostHandler= new AsyncCallbackJsonWebHandler("/testJsonPost", [](AsyncWebServerRequest *request, JsonVariant &json) { // handle the json request... }); testPostHandler->setMethod(HTTP_POST); server.addHandler(testPostHandler);
Stack Trace
no instance of overloaded function "AsyncWebServer::on" matches the argument listC/C++(304)
network-routes.cpp(24, 12): argument types are: (const char *, WebRequestMethod, lambda [](AsyncWebServerRequest *request, ArduinoJson::V742PB22::JsonVariant &json)->void)
network-routes.cpp(24, 12): object type is: AsyncWebServer
Minimal Reproductible Example (MRE)
server.on("/testJsonPost", HTTP_POST, [](AsyncWebServerRequest *request, JsonVariant &json) { // handle the json request... });
I confirm that:
- I have read the documentation.
- I have searched for similar discussions.
- I have searched for similar issues.
- I have looked at the examples.
- I have upgraded to the lasted version of ESPAsyncWebServer (and AsyncTCP for ESP32).