diff --git a/src/FilterLists.Agent/FilterLists.Agent.csproj b/src/FilterLists.Agent/FilterLists.Agent.csproj
index ceace7a57..be495110c 100644
--- a/src/FilterLists.Agent/FilterLists.Agent.csproj
+++ b/src/FilterLists.Agent/FilterLists.Agent.csproj
@@ -35,6 +35,7 @@
+
diff --git a/src/FilterLists.Agent/Infrastructure/AgentHttpClient.cs b/src/FilterLists.Agent/Infrastructure/AgentHttpClient.cs
new file mode 100644
index 000000000..76aa7b3e0
--- /dev/null
+++ b/src/FilterLists.Agent/Infrastructure/AgentHttpClient.cs
@@ -0,0 +1,11 @@
+using System.Net.Http;
+
+public class AgentHttpClient
+{
+ public AgentHttpClient(HttpClient client)
+ {
+ Client = client;
+ }
+
+ public HttpClient Client { get; }
+}
\ No newline at end of file
diff --git a/src/FilterLists.Agent/ListArchiver/DownloadRequestsByFileExtension/DownloadTxt.cs b/src/FilterLists.Agent/ListArchiver/DownloadRequestsByFileExtension/DownloadTxt.cs
index 0b5b0e572..3013215a2 100644
--- a/src/FilterLists.Agent/ListArchiver/DownloadRequestsByFileExtension/DownloadTxt.cs
+++ b/src/FilterLists.Agent/ListArchiver/DownloadRequestsByFileExtension/DownloadTxt.cs
@@ -25,9 +25,9 @@ public class Handler : AsyncRequestHandler
private readonly HttpClient _httpClient;
private readonly ILogger _logger;
- public Handler(HttpClient httpClient, ILogger logger)
+ public Handler(AgentHttpClient httpClient, ILogger logger)
{
- _httpClient = httpClient;
+ _httpClient = httpClient.Client;
_logger = logger;
}
diff --git a/src/FilterLists.Agent/Program.cs b/src/FilterLists.Agent/Program.cs
index 2fa52e08e..182e9a7d3 100644
--- a/src/FilterLists.Agent/Program.cs
+++ b/src/FilterLists.Agent/Program.cs
@@ -1,5 +1,4 @@
using System;
-using System.Net.Http;
using System.Threading.Tasks;
using Autofac;
using Autofac.Extensions.DependencyInjection;
@@ -28,14 +27,14 @@ public static async Task Main()
private static void RegisterServices()
{
var serviceCollection = new ServiceCollection();
- var containerBuilder = new ContainerBuilder();
// register Agent services
serviceCollection.AddLogging(b => b.AddConsole());
serviceCollection.AddMediatR(typeof(Program).Assembly);
- containerBuilder.RegisterType().AsImplementedInterfaces().SingleInstance();
- containerBuilder.RegisterType().SingleInstance();
+ serviceCollection.AddHttpClient();
+ serviceCollection.AddSingleton();
+ var containerBuilder = new ContainerBuilder();
containerBuilder.Populate(serviceCollection);
var container = containerBuilder.Build();
_serviceProvider = new AutofacServiceProvider(container);