|
@ -13,7 +13,7 @@ namespace BBWY.Common.Http |
|
|
{ |
|
|
{ |
|
|
public const string ContentType_Json = "application/json"; |
|
|
public const string ContentType_Json = "application/json"; |
|
|
public const string ContentType_Form = "application/x-www-form-urlencoded"; |
|
|
public const string ContentType_Form = "application/x-www-form-urlencoded"; |
|
|
public TimeSpan TimeOut { get; set; } = new TimeSpan(0, 0, 20); |
|
|
public TimeSpan TimeOut { get; set; } = new TimeSpan(0, 0, 40); |
|
|
|
|
|
|
|
|
private IHttpClientFactory httpClientFactory; |
|
|
private IHttpClientFactory httpClientFactory; |
|
|
|
|
|
|
|
@ -71,6 +71,7 @@ namespace BBWY.Common.Http |
|
|
|
|
|
|
|
|
using (var httpClient = string.IsNullOrEmpty(httpClientName) ? httpClientFactory.CreateClient() : httpClientFactory.CreateClient(httpClientName)) |
|
|
using (var httpClient = string.IsNullOrEmpty(httpClientName) ? httpClientFactory.CreateClient() : httpClientFactory.CreateClient(httpClientName)) |
|
|
{ |
|
|
{ |
|
|
|
|
|
httpClient.Timeout = TimeOut; |
|
|
using (var request = new HttpRequestMessage(httpMethod, url)) |
|
|
using (var request = new HttpRequestMessage(httpMethod, url)) |
|
|
{ |
|
|
{ |
|
|
if (requestHeaders != null && requestHeaders.Count > 0) |
|
|
if (requestHeaders != null && requestHeaders.Count > 0) |
|
|