diff --git a/Src/VTEX.Health/VtexHealthClient.cs b/Src/VTEX.Health/VtexHealthClient.cs
index 9219e6f0..b6be8fc0 100644
--- a/Src/VTEX.Health/VtexHealthClient.cs
+++ b/Src/VTEX.Health/VtexHealthClient.cs
@@ -44,10 +44,10 @@ public class VtexHealthClient : IVtexHealthClient
/// Initializes a new instance of the class.
///
/// The logger factory.
- /// The HTTP client.
+ /// The HTTP client factory.
/// loggerFactory
/// httpClient
- public VtexHealthClient(ILoggerFactory loggerFactory, HttpClient httpClient)
+ public VtexHealthClient(ILoggerFactory loggerFactory, IHttpClientFactory httpClientFactory)
{
if (loggerFactory == null)
{
@@ -55,8 +55,8 @@ public VtexHealthClient(ILoggerFactory loggerFactory, HttpClient httpClient)
}
_logger = loggerFactory.CreateLogger();
- _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
- }
+ _httpClient = httpClientFactory?.CreateClient() ?? throw new ArgumentNullException(nameof(httpClientFactory));
+ httpClientFactory?.CreateClient() ?? throw new ArgumentNullException(nameof(httpClientFactory));
#endregion
diff --git a/Src/VTEX/VTEXWrapper.cs b/Src/VTEX/VTEXWrapper.cs
index 3140fe61..2abd43a7 100644
--- a/Src/VTEX/VTEXWrapper.cs
+++ b/Src/VTEX/VTEXWrapper.cs
@@ -162,9 +162,8 @@ private async Task ServiceInvokerInternal(
var cookieContainer = new CookieContainer();
- using var handler = new HttpClientHandler { CookieContainer = cookieContainer };
-
- using var client = new HttpClient(handler);
+ var handler = new HttpClientHandler { CookieContainer = cookieContainer };
+ var client = _httpClientFactory.CreateClient();
ConfigureClient(client, requiresAuthentication);