diff --git a/src/webserver.h b/src/webserver.h
index f6d48c3..a9a1b45 100644
--- a/src/webserver.h
+++ b/src/webserver.h
@@ -28,11 +28,6 @@ namespace {
-
-
-
-
-
@@ -45,7 +40,14 @@ namespace {
}
void handleFormSend() {
- sendTextToSign("HELLO FORM");
+ String text = webServer.arg("text");
+
+ if (text.isEmpty()) {
+ webServer.send(404, "text/plain", "empty text");
+ return;
+ }
+
+ sendTextToSign(text);
// redirect back to root page
webServer.sendHeader("Location", "/");
@@ -54,7 +56,14 @@ namespace {
// RESTful API endpoint -- returns a proper status code rather than a redirect
void handleApiSend() {
- sendTextToSign("HELLO API");
+ String text = webServer.arg("text");
+
+ if (text.isEmpty()) {
+ webServer.send(404, "text/plain", "empty text");
+ return;
+ }
+
+ sendTextToSign(text);
webServer.send(200, "text/plain", "ok");
}
}