refit icon indicating copy to clipboard operation
refit copied to clipboard

DelegatingHandler not having HttpClient or HttpClientFactory set ?

Open Danielovich opened this issue 3 years ago • 0 comments

I am trying to access the HttpClient's base address in the DelegatingHandler (AuthHeaderHandler), but it's not set.

services.AddTransient<AuthHeaderHandler>();
services.AddRefitClient<ICubsApiClient>()
    .ConfigureHttpClient(c => c.BaseAddress = new System.Uri("https://domain.refit"))
    .AddHttpMessageHandler<AuthHeaderHandler>();

Seems to me I have to setup another HttpClient if i want this to work ?

In my AuthHeaderHandler i am doing this:

public AuthHeaderHandler(IHttpClientFactory httpClientFactory, IConfiguration config)

Thank you

Danielovich avatar Oct 27 '21 10:10 Danielovich