diff --git a/code/espurna/relay.ino b/code/espurna/relay.ino index 6b390fb9..a701910d 100644 --- a/code/espurna/relay.ino +++ b/code/espurna/relay.ino @@ -253,7 +253,8 @@ void relaySetupAPI() { } else { relayStatus(relayID, value == 1); } - }); + } + ); } diff --git a/code/espurna/web.ino b/code/espurna/web.ino index 9d68256b..dc103b09 100644 --- a/code/espurna/web.ino +++ b/code/espurna/web.ino @@ -587,9 +587,9 @@ ArRequestHandlerFunction _bindAPI(unsigned int apiID) { bool asJson = _asJson(request); web_api_t api = _apis[apiID]; - if (request->method() == HTTP_PUT) { - if (request->hasParam("value", true)) { - AsyncWebParameter* p = request->getParam("value", true); + if (api.putFn != NULL) { + if (request->hasParam("value", request->method() == HTTP_PUT)) { + AsyncWebParameter* p = request->getParam("value", request->method() == HTTP_PUT); (api.putFn)((p->value()).c_str()); } }