use POST for commands, it aligns better with REST specs
This commit is contained in:
parent
234649cdd2
commit
73f7283918
@ -15,7 +15,7 @@ namespace WebServer {
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
server.on("/command", HTTP_PUT, [](AsyncWebServerRequest *request) {
|
server.on("/commands", HTTP_POST, [](AsyncWebServerRequest *request) {
|
||||||
if (request->hasParam("id", true) && request->hasParam("state", true)) {
|
if (request->hasParam("id", true) && request->hasParam("state", true)) {
|
||||||
AsyncWebParameter* switchId = request->getParam("id", true);
|
AsyncWebParameter* switchId = request->getParam("id", true);
|
||||||
AsyncWebParameter* switchState = request->getParam("state", true);
|
AsyncWebParameter* switchState = request->getParam("state", true);
|
||||||
@ -31,7 +31,7 @@ namespace WebServer {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/command", HTTP_GET, [](AsyncWebServerRequest *request) {
|
server.on("/commands", HTTP_GET, [](AsyncWebServerRequest *request) {
|
||||||
string list;
|
string list;
|
||||||
for (auto it = Command::mapCommandIds.begin(); it != Command::mapCommandIds.end(); ++it)
|
for (auto it = Command::mapCommandIds.begin(); it != Command::mapCommandIds.end(); ++it)
|
||||||
list.append(it->first.c_str()).append("\n");
|
list.append(it->first.c_str()).append("\n");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user