34 lines
914 B
C#
34 lines
914 B
C#
using Hncore.Infrastructure.WebApi;
|
|
using System.Net.Http;
|
|
|
|
namespace Hncore.Infrastructure.Service
|
|
{
|
|
public class ServiceHttpClient
|
|
{
|
|
private IHttpClientFactory _httpClientFactory;
|
|
|
|
internal static string _BaseUrl = "";
|
|
|
|
public string BaseUrl => _BaseUrl;
|
|
|
|
public ServiceHttpClient(IHttpClientFactory httpClientFactory)
|
|
{
|
|
_httpClientFactory = httpClientFactory;
|
|
}
|
|
|
|
public HttpClient CreateHttpClient()
|
|
{
|
|
var client = _httpClientFactory.CreateClient();
|
|
client.BaseAddress = new System.Uri(_BaseUrl);
|
|
return client;
|
|
}
|
|
|
|
public HttpClient CreateInternalClient()
|
|
{
|
|
var client = _httpClientFactory.CreateInternalAuthClient();
|
|
client.BaseAddress = new System.Uri(_BaseUrl);
|
|
return client;
|
|
|
|
}
|
|
}
|
|
} |