summaryrefslogtreecommitdiff
path: root/src/driver.cpp
diff options
context:
space:
mode:
authorkkard2 <[email protected]>2026-06-10 17:27:42 +0200
committerkkard2 <[email protected]>2026-06-10 17:27:42 +0200
commit948fc36aa4ed012ac4943237e771b6d187d43ce5 (patch)
treeee08da896aa434eec484dd900b4b77428e5dfff2 /src/driver.cpp
parentb0a361b4c4a6b1b55965cb0ca6017d4c9557aaf5 (diff)
fix code (derogatory)
Diffstat (limited to 'src/driver.cpp')
-rw-r--r--src/driver.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/driver.cpp b/src/driver.cpp
index 2beff5b..a7b235c 100644
--- a/src/driver.cpp
+++ b/src/driver.cpp
@@ -63,10 +63,25 @@ void wifi_hotspot_start(const char *ssid, const char *password, WifiHandler hand
WiFi.softAP(ssid, password);
server.onNotFound([=]() {
+ String uri = server.uri();
+ String body;
+
+ // build body string from parsed args if plain isn't available
+ if (server.hasArg("plain")) {
+ body = server.arg("plain");
+ } else {
+ for (int i = 0; i < server.args(); i++) {
+ if (!body.isEmpty()) body += "&";
+ body += server.argName(i).c_str();
+ body += "=";
+ body += server.arg(i).c_str();
+ }
+ }
+
WifiRequest req = {
- .uri = server.uri().c_str(),
+ .uri = uri.c_str(),
.method = server.method() == HTTP_GET ? "GET" : "POST",
- .body = server.hasArg("plain") ? server.arg("plain").c_str() : nullptr,
+ .body = body.isEmpty() ? nullptr : body.c_str(),
};
WifiResponse res = handler(&req);
server.send(res.status, res.content_type, res.body);