初始提交
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user