as the HttpClientFactory implements the delegate pipeline for httpclient, instead of injecting HttpClient, you should inject HttpClientFactory, or use named or typed HttpClients (which implicitly use the factory).
Using DelegationHandler for HTTP Requests
Hi, I have a requirement to use a DelegationHandler. I have a ServiceA class and an AuthHandler class that inherits from the DelegationHandler class. I created a RestClient class which has an HTTPClient injected, and in this class, I have the common logic to call HttpClient methods, set queryParameters, set headers, etc. My ServiceA class is injecting the RestClient class and, in turn, calls RestClient methods, which, in turn, make all the HTTP requests. I have implemented it like this as I want to keep a generic RestClient class so that all my services, like ServiceA, ServiceB, can call this class, and I do not need to repeat common code. But if I follow this approach, then I am not able to use the DelegationHandler, and it is not invoked. Can you suggest a way?