This commit is contained in:
qianhao.xu
2024-05-07 13:57:18 +08:00
parent 11dfe38106
commit b13aaaa6b0
4 changed files with 24 additions and 8 deletions

View File

@@ -34,8 +34,15 @@ namespace Infrastructure
using HttpContent httpContent = new StringContent(postData, Encoding.UTF8);
if (contentType != null)
httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
HttpResponseMessage response = client.PostAsync(url, httpContent).Result;
HttpResponseMessage response = null;
try
{
response = client.PostAsync(url, httpContent).Result;
}catch (Exception ex)
{
return "异常:"+ex.Message;
}
return response.Content.ReadAsStringAsync().Result;
}