OA联调,需要utf8
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
|
||||
namespace YLErp.Modules.ApiModule
|
||||
{
|
||||
@@ -83,7 +84,7 @@ namespace YLErp.Modules.ApiModule
|
||||
public string PostJson(string apiPath, object postData, Action<HttpRequestMessage> requestHandle)
|
||||
{
|
||||
var str = JsonHelper.Serialize(postData) ?? string.Empty;
|
||||
using (var content = new StringContent(str))
|
||||
using (var content = new StringContent(str, Encoding.UTF8, "application/json"))
|
||||
using (var request = new HttpRequestMessage()
|
||||
{
|
||||
Method = HttpMethod.Post,
|
||||
@@ -93,7 +94,7 @@ namespace YLErp.Modules.ApiModule
|
||||
{
|
||||
request.Headers.Add("Accept-Encoding", "gzip");
|
||||
requestHandle?.Invoke(request);
|
||||
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
// content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
LogFactory.GetLogger<HttpClientWrap>().Info($"url:{apiPath}\r\npostData:{str}\r\n{content.ToJson()}");
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user