Browse Source

api: actually call PUT method of the handler

mcspr-patch-1
Maxim Prokhorov 4 years ago
parent
commit
7c2fe35269
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      code/espurna/api.cpp

+ 5
- 3
code/espurna/api.cpp View File

@ -167,9 +167,11 @@ bool _apiDispatchRequest(const String& url, AsyncWebServerRequest* request) {
break; break;
} }
auto value = request->getParam("value", request->method() == HTTP_PUT)->value(); auto value = request->getParam("value", request->method() == HTTP_PUT)->value();
//memcpy(buffer.data, value.c_str(), value.length());
std::copy(value.c_str(), value.c_str() + value.length(), buffer.data);
match.api->get.basic(*match.api, buffer);
if (buffer.size < (value.length() + 1ul)) {
break;
}
std::copy(value.c_str(), value.c_str() + value.length() + 1, buffer.data);
match.api->put.basic(*match.api, buffer);
buffer.erase(); buffer.erase();
} }


Loading…
Cancel
Save