This commit is contained in:
qianhao.xu
2024-04-30 15:10:44 +08:00
parent 3852de24f9
commit 09880cbc5f
3 changed files with 9 additions and 3 deletions

View File

@@ -19,7 +19,12 @@ namespace Infrastructure
public static string HttpPost(string url, string postData = null, string contentType = null, int timeOut = 30, Dictionary<string, string> headers = null)
{
postData ??= "";
using HttpClient client = new HttpClient();
var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (message, certificate2, arg3, arg4) => true //忽略掉证书异常
};
using HttpClient client = new HttpClient(httpClientHandler);
client.Timeout = new TimeSpan(0, 0, timeOut);
if (headers != null)
{