Skip to content

Commit 90debcc

Browse files
authored
Merge pull request #125 from moerchel/master
feat: add user and password to validation ping
2 parents 892c3a9 + c34e84c commit 90debcc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/InfluxDbClient.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,12 @@ bool InfluxDBClient::validateConnection() {
545545
}
546546
// on version 1.x /ping will by default return status code 204, without verbose
547547
String url = _serverUrl + (_dbVersion==2?"/health":"/ping?verbose=true");
548+
if(_dbVersion==1 && _user.length() > 0 && _password.length() > 0) {
549+
url += "&u=";
550+
url += urlEncode(_user.c_str());
551+
url += "&p=";
552+
url += urlEncode(_password.c_str());
553+
}
548554
INFLUXDB_CLIENT_DEBUG("[D] Validating connection to %s\n", url.c_str());
549555

550556
if(!_httpClient->begin(*_wifiClient, url)) {

0 commit comments

Comments
 (0)