This commit is contained in:
2025-05-13 12:10:14 +08:00
parent 8f4fa9f998
commit e8f2082326

View File

@@ -52,7 +52,7 @@ public class GainfoFacesController : ControllerBase
var headers = InitRequest(url, body, key, secret);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(headers["Accept"]));
var content = new StringContent(body, Encoding.UTF8, headers["Content-Type"]);
var content = new StringContent(body, Encoding.UTF8, "application/json");
foreach (var item in headers.Where(x => x.Key != "Accept").Where(x => x.Key != "Content-Type"))
{
content.Headers.Add(item.Key, item.Value);
@@ -67,10 +67,10 @@ public class GainfoFacesController : ControllerBase
var header = new Dictionary<string, string>();
// Accept
header.Add("Accept", "application/json");
header.Add("Accept", "application/json;");
// ContentType
header.Add("Content-Type", "application/json");
header.Add("Content-Type", "application/json; charset=utf-8");
//if POST content-md5,be careful it must be lower case.
string contentMd5 = computeContentMd5(body);