API: Health endpoint returns synchronized state

This commit is contained in:
Dennis Reimann
2020-04-21 10:39:04 +02:00
parent 3bd5c3e1b5
commit 70d1056d48
5 changed files with 44 additions and 9 deletions

View File

@@ -1,15 +1,16 @@
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using BTCPayServer.Client.Models;
namespace BTCPayServer.Client
{
public partial class BTCPayServerClient
{
public virtual async Task<bool> IsHealthy(CancellationToken token = default)
public virtual async Task<ApiHealthData> GetHealth(CancellationToken token = default)
{
var response = await _httpClient.SendAsync(CreateHttpRequest("api/v1/health"), token);
return response.IsSuccessStatusCode;
var response = await _httpClient.SendAsync(CreateHttpRequest("api/v1/health", bodyPayload: new {}), token);
return await HandleResponse<ApiHealthData>(response);
}
}
}