Closed
Description
Using the code defined in the README https://github.com/reactiveui/refit#reducing-header-boilerplate-with-delegatinghandlers-authorization-headers-worked-example, running the app results in an exception:
Unexpected application termination! "The 'InnerHandler' property must be null. 'DelegatingHandler' instances provided to 'HttpMessageHandlerBuilder' must not be reused or cached.\nHandler: 'Easee.Connector.AuthHeaderHandler'"
System.InvalidOperationException: The 'InnerHandler' property must be null. 'DelegatingHandler' instances provided to 'HttpMessageHandlerBuilder' must not be reused or cached.
Handler: 'Easee.Connector.AuthHeaderHandler'
at HttpMessageHandler Microsoft.Extensions.Http.HttpMessageHandlerBuilder.CreateHandlerPipeline(HttpMessageHandler primaryHandler, IEnumerable<DelegatingHandler> additionalHandlers)
at HttpMessageHandler Microsoft.Extensions.Http.DefaultHttpMessageHandlerBuilder.Build()
at ActiveHandlerTrackingEntry Microsoft.Extensions.Http.DefaultHttpClientFactory.CreateHandlerEntry(string name)
at ActiveHandlerTrackingEntry Microsoft.Extensions.Http.DefaultHttpClientFactory+<>c__DisplayClass14_0.<.ctor>b__1(?)+() => { }
at void System.Lazy<T>.ViaFactory(LazyThreadSafetyMode mode)
at void System.Lazy<T>.ExecutionAndPublication(LazyHelper executionAndPublication, bool useDefaultConstructor)
at T System.Lazy<T>.CreateValue()
at T System.Lazy<T>.get_Value()
at HttpMessageHandler Microsoft.Extensions.Http.DefaultHttpClientFactory.CreateHandler(string name)
at HttpClient Microsoft.Extensions.Http.DefaultHttpClientFactory.CreateClient(string name)
Steps To Reproduce
Expected behavior
My app to run.
I believe you shouldn't set the InnerHandler
Environment
- OS: macOS 12.5
- .NET Core: 6