Closed
Description
Because HTTPClient::PATCH is missing in the library
I tried it with the basic function sendRequest(), but then I get an connection refused error.
HTTPClient httpClient;
httpClient.begin(url);
httpClient.setAuthorization(PIMATIC_USER, PIMATIC_PWD);
int httpCode = httpClient.sendRequest("PATCH", content);
if (httpCode > 0) {
Serial.printf("[HTTP] PATCH... code: %d\n", httpCode);
} else {
Serial.printf("[HTTP] GET... failed, error: %s\n", httpClient.errorToString(httpCode).c_str());
}
httpClient.end();
For comparison a low level solution with WiFiClient works on same server.
WiFiClient client;
...
client.print("PATCH " + url + " HTTP/1.1\r\n" +
"Authorization: Basic " + unameenc + "\r\n" +
"Host: " + HOST_IP + "\r\n" +
"Content-Type: application/json" + "\r\n" +
"Content-Length: " + content.length() + "\r\n\r\n" +
content);