reactiveui / refit

The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface.
https://reactiveui.github.io/refit/
MIT License
8.65k stars 744 forks source link

Support passing a delegate to configure http clients #1919

Closed velvolue closed 2 weeks ago

velvolue commented 2 weeks ago

Is your feature request related to a problem? Please describe.

We'd like to configure the HttpClient instance for each request, but using ConfigureHttpClient only configures the named HttpClient and is not applied for every (Refit internal) call to CreateClient.

Describe the solution you'd like

Pass a delegate to configure HttpClients when add Refit client.

Describe alternatives you've considered

Using message handlers is an alternative, but it would be better to have the option of configuring the HttpClient.

Describe suggestions on how to achieve the feature

AddRefitClient`1 should accept an Action<HttpClient> parameter that is passed on to AddHttpClient.

Additional context

It should be relatively straight forward to implement this. If given the green light, I could attempt to make a PR.

velvolue commented 2 weeks ago

I must have gotten something mixed up.. I see now that passing a configuration delegate to AddHttpClient is just calling ConfigureHttpClient under the hood...

github-actions[bot] commented 1 day ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.