What happens when we create client object using
var client=new HttpClient();
And when we use IHttpClientFactory
builder.Services.AddHttpClient();
and using it through Dependency Injection
public readonly IHttpClientFactory _clientFactory;
public RequestController(ClientPolicy clientPolicy,IHttpClientFactory clientFactory)
{
_clientFactory = clientFactory;
}
var client= _clientFactory.CreateClient();