According to the best practice, you are supposed to instantiate a single instance of HttpClient and reuse it throughtout your application lifecycle.
But how do you do this when you need to inject a custom HttpClientHandler for every request? (i.e I need to load a custom certificate based on who is calling)
var clientHandler = new HttpClientHandler();
clientHandler.ClientCertificates.Add(customCertificate);
using (var httpClient = new HttpClient(clientHandler))
{
// Call another endpoint
}
Is there any advantage is to creating multiple singleton instances of HttpClient for every use case?