Add detail param to allow listing of select options in WebServer REST API (#5503)

This commit is contained in:
Daniel Baulig 2023-10-11 18:55:01 -07:00 committed by GitHub
parent 2fc4e88271
commit 689dcd1e24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -805,7 +805,12 @@ void WebServer::handle_select_request(AsyncWebServerRequest *request, const UrlM
continue;
if (request->method() == HTTP_GET) {
std::string data = this->select_json(obj, obj->state, DETAIL_STATE);
auto detail = DETAIL_STATE;
auto *param = request->getParam("detail");
if (param && param->value() == "all") {
detail = DETAIL_ALL;
}
std::string data = this->select_json(obj, obj->state, detail);
request->send(200, "application/json", data.c_str());
return;
}