Closed wizhi closed 3 years ago
That's a fair request. That will be in the next version, but I can't say when that will be released.
In the meantime, you should be able to do:
services.AddRestEaseClient<T>(...).ConfigurePrimaryHttpMessageHandler(() => new ModifyingClientHttpHandler(requestModifier));
(Let me know if that doesn't work, as I'll need to change how I've implemented it!)
I'm in need of a way of setting the
Authorization
header for requests, which is handled quite neatly using aRequestModifier
. This doesn't seem to be possible, however, if I'm registering my service using theRestEase.HttpClientFactory
abstraction, since this doesn't expose the same arguments asRestClient.For<T>
.I'm not seeing any way of specifying a
RequestModifier
for clients, registered through any of theIServiceCollection.AddRestEaseClient<T>()
overloads.Am I missing some way of using the
RestEase.HttpClientFactory
abstraction with a customRequestModifier
?If not, what would be the recommended approach to doing something similar?