Skip to content

Commit b63dfe6

Browse files
committed
feat: Using the /health endpoint for validation
1 parent 1d324f0 commit b63dfe6

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
## Version 3.3.0 (in progress)
33
- [NEW] Added possibility skip server certification validation (`setInsecure()` method)
44
- [NEW] Added possibility to query flux on InfuxDB 1.8 using V1 approach
5+
- [NEW] `validateConnection()` can be used also for the [forward compatibility](https://docs.influxdata.com/influxdb/latest/tools/api/#influxdb-2-0-api-compatibility-endpoints) connection to InfluxDB 1.8
56
- [FIX] Debug compilation error
67
- [FIX] SecureBatchWrite compile error
78

src/InfluxDbClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ bool InfluxDBClient::validateConnection() {
508508
return false;
509509
}
510510
// on version 1.x /ping will by default return status code 204, without verbose
511-
String url = _serverUrl + (_dbVersion==2?"/ready":"/ping?verbose=true");
511+
String url = _serverUrl + (_dbVersion==2?"/health":"/ping?verbose=true");
512512
INFLUXDB_CLIENT_DEBUG("[D] Validating connection to %s\n", url.c_str());
513513

514514
if(!_httpClient.begin(*_wifiClient, url)) {

test/server/server.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ app.get('/ready', (req,res) => {
2727
lastUserAgent = req.get('User-Agent');
2828
res.status(200).send("<html><body><h1>OK</h1></body></html>");
2929
})
30+
app.get('/health', (req,res) => {
31+
lastUserAgent = req.get('User-Agent');
32+
res.status(200).send("<html><body><h1>OK</h1></body></html>");
33+
})
3034

3135
app.get('/ping', (req,res) => {
3236
lastUserAgent = req.get('User-Agent');

test/test.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void setup() {
4848
}
4949

5050
void loop() {
51-
//tests
51+
// Basic tests
5252
testPoint();
5353
testFluxTypes();
5454
testFluxParserEmpty();
@@ -66,6 +66,7 @@ void loop() {
6666
testInit();
6767
testV1();
6868
testUserAgent();
69+
// Advanced tests
6970
testFailedWrites();
7071
testTimestamp();
7172
testRetryOnFailedConnection();

0 commit comments

Comments
 (0)