title: How to pass/inject more than one HttpClient parameter to a typed HttpClientClass?
body: <p>I want to register a typed HttpClient as here <a href="https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests#implement-your-typed-client-classes-that-use-the-injected-and-configured-httpclient" rel="nofollow noreferrer">Microsoft docs</a>.
  Basically, the approach should be</p>
  
  <p>services.AddHttpClient();</p>
  
  <p>normally the pattern of these classes receive only the HttpClient class as a parameter and you implement the logic to call the endpoint. In my case, I need to use 2 HttpClient inside my MyHttpClient, one that pings the endpoint and the other one that talks with an IdentityProvider to discover the refreshEndpoints to refresh my cookies.</p>
  
  <pre><code>public class MyHttpClient : IMyHttpClient
  {
      public MyHttpClient (HttpClient httpClient, 
                           HttpClient refreshHttpClient)
      {
      }
  }
  </code></pre>
  
  <p>If I am trying to resolve from a controller an IMyHttpClient, I get an error saying it can't resolve an HttpClient.</p>
  
  <p>In the GitHub code on line 43 <a href="https://github.com/aspnet/HttpClientFactory/blob/6fae77bfaa08e509ca34817d08d4f5e7d019e343/src/Microsoft.Extensions.Http/DependencyInjection/HttpClientFactoryServiceCollectionExtensions.cs" rel="nofollow noreferrer">AddHttpClient</a> you can see that is calling 
  DefaultTypedHttpClientFactory. 
  If you go to the implementation of the <a href="https://github.com/aspnet/HttpClientFactory/blob/f30c84e8b69e9503cb0f471f51417ceee1ef4817/src/Microsoft.Extensions.Http/DefaultTypedHttpClientFactory.cs" rel="nofollow noreferrer">DefaultTypedHttpClientFactory implementation</a> you will notice that is a generic type. And when it calls CreateClient it only passes one parameter to the constructor on line 39.</p>
  
  <p>The only workaround I am seeing here is to not create a typed client and register a normal class that receives an IHttpClientFactory and create and configure my clients on the fly, not as typed.
  Any other idea?</p>