1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-16 23:27:30 -05:00

Use IHttpClientFactory in more places

This commit is contained in:
Justin Baur
2025-05-01 08:59:15 -04:00
parent 7a99f5dc5d
commit 284501a493
7 changed files with 44 additions and 25 deletions

View File

@ -2,6 +2,7 @@
using System.Net.Http.Json;
using Bit.Migrator;
using Bit.Setup.Enums;
using Microsoft.Extensions.DependencyInjection;
namespace Bit.Setup;
@ -285,7 +286,14 @@ public class Program
url = $"{installationUrl}/installations/";
}
var response = new HttpClient().GetAsync(url + _context.Install.InstallationId).GetAwaiter().GetResult();
// We need to get an HttpClient that has been configured with custom trust certificates.
var httpClient = new ServiceCollection()
.AddX509ChainCustomization()
.BuildServiceProvider()
.GetRequiredService<IHttpClientFactory>()
.CreateClient();
var response = httpClient.GetAsync(url + _context.Install.InstallationId).GetAwaiter().GetResult();
if (!response.IsSuccessStatusCode)
{