diff --git a/src/LinkAce.NET/LinkAceClient.cs b/src/LinkAce.NET/LinkAceClient.cs
index cbf222d..4a9473c 100644
--- a/src/LinkAce.NET/LinkAceClient.cs
+++ b/src/LinkAce.NET/LinkAceClient.cs
@@ -16,12 +16,13 @@ namespace LinkAce.NET;
public class LinkAceClient
{
private static string? _apiUrl;
- private static HttpClient _client = new();
+ private static HttpClient _client;
///
/// Initializes a new instance of the class with the specified URL and HTTP client.
///
/// The base URL of the LinkAce.NET instance.
/// The HTTP client to use for requests.
+ [Obsolete("Use the constructor with the API token instead.")]
public LinkAceClient(string linkAceUrl, HttpClient httpClient)
{
_apiUrl = $"{linkAceUrl}/api/v1";
@@ -32,10 +33,12 @@ public LinkAceClient(string linkAceUrl, HttpClient httpClient)
///
/// The base URL of the LinkAce.NET instance.
/// The API token for authentication.
- public LinkAceClient(string linkAceUrl, string apiToken)
+ /// The HTTP client to use for requests.
+ public LinkAceClient(string linkAceUrl, string apiToken, HttpClient? client = null)
{
_apiUrl = $"{linkAceUrl}/api/v1";
// Setup HttpClient
+ _client = client ?? new HttpClient();
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaTypeNames.Application.Json));
_client.DefaultRequestHeaders.UserAgent.Add(Meta.UserAgent);
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiToken);