diff --git a/src/LibSql.Http.Client/LibSqlHttpClient.cs b/src/LibSql.Http.Client/LibSqlHttpClient.cs index 2e92664..d47b9bd 100644 --- a/src/LibSql.Http.Client/LibSqlHttpClient.cs +++ b/src/LibSql.Http.Client/LibSqlHttpClient.cs @@ -11,11 +11,12 @@ namespace LibSql.Http.Client; public sealed class LibSqlHttpClient : ILibSqlHttpClient { private const string PipelineV3Path = "/v3/pipeline"; + private const string HealthPath = "/health"; private readonly AuthenticationHeaderValue? _authHeaderValue; private readonly HttpClient _httpClient; private readonly Uri _pipelineUri; - private readonly Uri _baseUri; + private readonly string _healthUri; /// /// Creates a new instance of . @@ -71,7 +72,7 @@ public LibSqlHttpClient(HttpClient httpClient, Uri? url = null, string? authToke "URL not set. Please provide a URL either in the constructor or as a parameter or via HttpClient.BaseAddress."); _pipelineUri = new Uri(url, PipelineV3Path); - _baseUri = url; + _healthUri = new Uri(url, HealthPath).ToString(); _httpClient = httpClient; @@ -192,7 +193,7 @@ public Task QueryMultipleAsync( /// public async Task HealthCheckAsync(CancellationToken cancellationToken = default) { - var res = await _httpClient.GetAsync("/health", HttpCompletionOption.ResponseHeadersRead, cancellationToken); + using var res = await _httpClient.GetAsync(_healthUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken); return res.IsSuccessStatusCode; }