Commit 255ce91c authored by PhiBo's avatar PhiBo 🚀

Check if argument with given name exists

parent a28929ee
......@@ -11,7 +11,7 @@ void handleAPIHostname()
hostname[NODE_EEPROM_API_HOSTNAME_MAX_LENGTH] = '\0';
server->send(200, "text/plain", hostname);
} else if (server->method() == HTTP_POST) {
if(server->args() == 0) {
if(!server->hasArg("hostname")) {
server->send(400, "text/plain", "No hostname given");
return;
}
......@@ -33,7 +33,7 @@ void handleAPIPort()
port = getAPIPort();
server->send(200, "text/plain", String(port));
} else if (server->method() == HTTP_POST) {
if(server->args() == 0) {
if(!server->hasArg("port")) {
server->send(400, "text/plain", "No port given");
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment