[store] other use default client factory

This commit is contained in:
Andriy
2023-07-28 23:14:36 +03:00
parent 42509dcacd
commit 2a37b27bb4
6 changed files with 15 additions and 19 deletions
@@ -9,15 +9,12 @@ public abstract class AnimalAsAService : IRandomMediaService
private readonly HttpClient _httpClient;
public abstract StoreItem StoreItem { get; }
protected AnimalAsAService(Uri baseAddress)
protected AnimalAsAService(IHttpClientFactory factory, Uri baseAddress)
{
_httpClient = new HttpClient
{
BaseAddress = baseAddress
};
_httpClient = factory.CreateClient();
_httpClient.BaseAddress = baseAddress;
}
public async Task<RandomMedia> GetRandomMediaAsync()
{
var resp = await _httpClient.GetAsync("images/search");