diff --git a/CHANGELOG.md b/CHANGELOG.md index ff64d9542..af30f0af5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## 4.0.0 [unreleased] +### Bug Fixes +1. [#297](https://github.com/influxdata/influxdb-client-csharp/pull/297): Get version from `X-Influxdb-Version` header + ## 4.0.0-rc3 [2022-03-04] ### Features diff --git a/Client.Core/Internal/AbstractRestClient.cs b/Client.Core/Internal/AbstractRestClient.cs index 66c0f6941..60692aae7 100644 --- a/Client.Core/Internal/AbstractRestClient.cs +++ b/Client.Core/Internal/AbstractRestClient.cs @@ -49,7 +49,7 @@ private string GetVersion(RestResponse responseHttp) Arguments.CheckNotNull(responseHttp, "responseHttp"); var value = responseHttp.Headers - .Where(header => header.Name.Equals("X-Influxdb-Version")) + .Where(header => header.Name.Equals("X-Influxdb-Version", StringComparison.OrdinalIgnoreCase)) .Select(header => header.Value.ToString()) .FirstOrDefault(); diff --git a/Client.Test/InfluxDbClientTest.cs b/Client.Test/InfluxDbClientTest.cs index 1025cf5fc..df5ecb0fa 100644 --- a/Client.Test/InfluxDbClientTest.cs +++ b/Client.Test/InfluxDbClientTest.cs @@ -319,5 +319,15 @@ public void HttpClientIsDisposed() Assert.AreEqual(true, disposed); } + + [Test] + public async Task VersionIsNotCaseSensitive() + { + MockServer.Given(Request.Create().WithPath("/ping").UsingGet()) + .RespondWith(Response.Create().WithStatusCode(204) + .WithHeader("x-influxdb-version", "2.0.0")); + + Assert.AreEqual("2.0.0", await _client.VersionAsync()); + } } } \ No newline at end of file diff --git a/Client/InfluxDBClient.cs b/Client/InfluxDBClient.cs index b36e4055c..6839be601 100644 --- a/Client/InfluxDBClient.cs +++ b/Client/InfluxDBClient.cs @@ -443,7 +443,7 @@ public async Task VersionAsync() } /// - /// The readiness of the InfluxDB 2.0. + /// Check the readiness of InfluxDB Server at startup. It is not supported by InfluxDB Cloud. /// /// return null if the InfluxDB is not ready public async Task ReadyAsync()