Switch back to AP
Closed this issue · 2 comments
Hi,
I m trying to switch to AP mode but seems it doesn't work.
Here's the command I use
curl -X POST "IP_ESP32/api/softap/start"
But I get an 52 response and I can't see my AP.
With Postman I get an "errror: socket hang up"
Btw, from your doc you mentioned
api/wifi/softAp/start
api/wifi/softAp/stop
Theses resources return 404 errors
They work a little bit better when they are in lowercase.
Hi,
sorry for the late response. I fixed the doc and corrected it to be lowercase. Can you see [WIFI] Starting configuration portal on AP SSID ...
on your serial console when you execute the softap/start?
Regards
Martin
I experience the same thing on Postman (getting "error: socket hang up").
In my case, I fixed it by setting Content-Type
to application/json
(in case it is not set), and sending an empty JSON body of just { }
.
I'm a beginner, too, but I guess because the code is
webServer->on((apiPrefix + "/softap/start").c_str(), HTTP_POST, [&](AsyncWebServerRequest * request){}, NULL,
[&](AsyncWebServerRequest * request, uint8_t *data, size_t len, size_t index, size_t total) { ... });
With this overload, the last param is ArBodyHandlerFunction onBody
. I guess it actually requires a body although we do not use it. So, that's why from Postman we still have to send a placeholder body. Maybe Martin can explain better.