check for "http" before allocating a http-client

This commit is contained in:
MichaelDvP
2026-07-11 19:12:34 +02:00
parent 193e5d591c
commit 188cc7b666

View File

@@ -707,7 +707,6 @@ std::string compute(const std::string & expr) {
std::string cmd = expr_new.substr(f, e - f).c_str();
JsonDocument doc;
if (DeserializationError::Ok == deserializeJson(doc, cmd)) {
HTTPClient * http = new HTTPClient;
std::string url, header_s, value_s, method_s, key_s, keys_s;
// search keys lower case
for (JsonPair p : doc.as<JsonObject>()) {
@@ -727,6 +726,8 @@ std::string compute(const std::string & expr) {
keys_s = p.key().c_str();
}
}
if (url.substr(0, 4) == "http") { // match http and https
HTTPClient * http = new HTTPClient;
if (http->begin(url.c_str())) {
int httpResult = 0;
for (JsonPair p : doc[header_s].as<JsonObject>()) {
@@ -780,6 +781,7 @@ std::string compute(const std::string & expr) {
}
delete http;
}
}
f = expr_new.find_first_of('{', e);
}