Add the ability to register Refit clients as keyed services by fubar-coder · Pull Request #1981 · reactiveui/refit
This PR fixes #1876.
- Added new constructor to
AuthenticatedHttpClientHandlerwhich doesn't automatically set theInnerHandlerproperty - Adds extension methods to register the Refit client as keyed service
- Added unit tests
Why did I add the new constructor to AuthenticatedHttpClientHandler?
- To keep the PR as small as possible by avoiding the duplication of code
- Enable the a behavior compatible with
IHttpClientBuilderby ...- ... avoiding the usage of obsolete functions
- ... avoid setting
InnerHandler, because this will be done by the builder itself
Future changes (not scope of this PR)
AuthenticatedHttpClientHandler: Remove the old constructorAuthenticatedHttpClientHandler: Remove theinnerHandlerparameter for the new constructorAuthenticatedHttpClientHandler: Fix the call sites- Don't call the obsoleted
ConfigureHttpMessageHandlerBuilder - Fix the unit tests
Behavioral changes
When no httpClientName was specified, the UniqueName.ForType<T> is used and the string representation of the serviceKey (when not null or empty string) gets appended to the unique type name, e.g. Refit.Implementation.Generated+IFooWithOtherAttribute, Refit.Tests, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null, ServiceKey=keyed