I'm trying to set up an ESP32 (DOIT ESP32 DEVKIT V1 in the Arduino IDE, with Espressif's WiFi libraries) with the following includes so far:
#include <WiFi.h> #include <WiFiClient.h> #include <WiFiAP.h> #include <HTTPSServer.hpp> #include <SSLCert.hpp> #include <HTTPRequest.hpp> #include <HTTPResponse.hpp>
Now, if I have a callback routine that's set up with
ResourceNode * nodeEchoPost = new ResourceNode("/cmd", "POST", &handleEcho);
how can I parse out the POST request string? On the serial console I get
[HTTPS:I] Request: POST /cmd
which is a debug output from the HTTPSRequest library itself. But I have no clue how to get that '/cmd' string for my own use! I've tried the example code of
byte buffer; size_t s = req->readBytes(buffer, 256);
getting a buffer that only returns garbage, probably because all the request is in the POST statement and the body is empty.
Since all I need is the request-info
to chop up and use, well.. how do I get that out from the library? I've been googling around, and looking in the library header files, without much luck.
Also, is there any advantage to using the WiFiClientSecure library instead, since everything already goes over HTTPS? That's more of a side question, though if it makes it easier to grab the Request string that way, I'm totally fine with accepting that.