Skip to content

Commit a8096e4

Browse files
committed
feat: fix health check to use full uri
1 parent befb411 commit a8096e4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/LibSql.Http.Client/LibSqlHttpClient.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ namespace LibSql.Http.Client;
1111
public sealed class LibSqlHttpClient : ILibSqlHttpClient
1212
{
1313
private const string PipelineV3Path = "/v3/pipeline";
14+
private const string HealthPath = "/health";
1415
private readonly AuthenticationHeaderValue? _authHeaderValue;
1516

1617
private readonly HttpClient _httpClient;
1718
private readonly Uri _pipelineUri;
18-
private readonly Uri _baseUri;
19+
private readonly string _healthUri;
1920

2021
/// <summary>
2122
/// Creates a new instance of <see cref="LibSqlHttpClient" />.
@@ -71,7 +72,7 @@ public LibSqlHttpClient(HttpClient httpClient, Uri? url = null, string? authToke
7172
"URL not set. Please provide a URL either in the constructor or as a parameter or via HttpClient.BaseAddress.");
7273

7374
_pipelineUri = new Uri(url, PipelineV3Path);
74-
_baseUri = url;
75+
_healthUri = new Uri(url, HealthPath).ToString();
7576

7677
_httpClient = httpClient;
7778

@@ -192,7 +193,7 @@ public Task<IResultReader> QueryMultipleAsync(
192193
/// <inheritdoc />
193194
public async Task<bool> HealthCheckAsync(CancellationToken cancellationToken = default)
194195
{
195-
var res = await _httpClient.GetAsync("/health", HttpCompletionOption.ResponseHeadersRead, cancellationToken);
196+
using var res = await _httpClient.GetAsync(_healthUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
196197

197198
return res.IsSuccessStatusCode;
198199
}

0 commit comments

Comments
 (0)