flagsmith-dotnet-client icon indicating copy to clipboard operation
flagsmith-dotnet-client copied to clipboard

Question: DI registration example

Open vpetrusevici opened this issue 1 year ago • 1 comments

Hi guys! I see in the example you register Flagsmith client as singleton, but in fact this is a typed httpclient. Is it better to use this approach mb?

services.Configure<FlagsmithConfiguration>(builder.Configuration.GetSection(nameof(FlagsmithConfiguration)));
services.AddHttpClient<IFlagsmithClient, FlagsmithClient>(nameof(FlagsmithClient));

Because static/singleton HttpClient doesn't respect DNS changes and is considered bad practice. See details here

vpetrusevici avatar Oct 26 '23 11:10 vpetrusevici

@vpetrusevici thank you for bringing this to our attention. We will consider your comments. If you like to build a PR with the proposed changes it would be also much appreciated.

novakzaballa avatar Oct 26 '23 15:10 novakzaballa