HttpClient takes an HttpMessageHandler argument in two of its constructors.
Is there any easy way to change the handler after the HttpClient has been created without creating a new HttpClient instance?
If you keep a reference to the actual Handler
, then you can modify the Handler after it has been created and inserted into the HttpClient
. Not sure if you can change it to another Handler type however.
It's pretty dumb that you cannot retrieve the Handler through the HttpClient
reference, such as HttpClient.Handler
, but what I mentioned above works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With