Refactor HttpClient usage and NTLM auth handling
Centralize HttpClient configuration using IHttpClientFactory with a named "Default" client. Move NTLM authentication logic from HttpClientHandler to request-level options, improving testability and aligning with .NET best practices.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
using MediatR;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ReC.Application.Common.Behaviors;
|
||||
using ReC.Application.Common.Options;
|
||||
using System.Reflection;
|
||||
using FluentValidation;
|
||||
|
||||
namespace ReC.Application;
|
||||
|
||||
@@ -35,7 +35,11 @@ public static class DependencyInjection
|
||||
cfg.LicenseKey = configOpt.LuckyPennySoftwareLicenseKey;
|
||||
});
|
||||
|
||||
services.AddHttpClient();
|
||||
services.AddHttpClient("Default")
|
||||
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
|
||||
{
|
||||
UseDefaultCredentials = false
|
||||
});
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user