Browse Source

http 40s timeout

qianyi
shanji 2 years ago
parent
commit
94b6f5a5e8
  1. 3
      BBWY.Common/Http/RestAPIService.cs

3
BBWY.Common/Http/RestAPIService.cs

@ -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)

Loading…
Cancel
Save