Refactor HTTP client setup in BuildStaticClient
Simplified the HTTP client configuration in the `BuildStaticClient` method of the `ReC.Client` namespace. Replaced the explicit use of `Services.AddHttpClient` with a call to `Services.AddRecClient(apiUri)`. This change improves code readability and reusability by encapsulating the HTTP client setup logic in a dedicated method or extension.
This commit is contained in:
parent
3f7ebdb632
commit
470902911e
@ -84,10 +84,7 @@ namespace ReC.Client
|
|||||||
if(Provider != null)
|
if(Provider != null)
|
||||||
throw new InvalidOperationException("Static Provider is already built.");
|
throw new InvalidOperationException("Static Provider is already built.");
|
||||||
|
|
||||||
Services.AddHttpClient(ClientName, client =>
|
Services.AddRecClient(apiUri);
|
||||||
{
|
|
||||||
client.BaseAddress = new Uri(apiUri);
|
|
||||||
});
|
|
||||||
Provider = Services.BuildServiceProvider();
|
Provider = Services.BuildServiceProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user