test .
This commit is contained in:
@@ -49,20 +49,21 @@ public class GainfoFacesController : ControllerBase
|
||||
var key = "27390082";
|
||||
var secret = "MLl7Dv7p5Pgc9XYI3r4O";
|
||||
|
||||
// HttpUtillib.SetPlatformInfo(key, secret, "10.32.0.10");
|
||||
// HttpUtillib.HttpPost(url, body, 15);
|
||||
HttpUtillib.SetPlatformInfo(key, secret, "10.32.0.10");
|
||||
var r = HttpUtillib.HttpPost(url, body, 15);
|
||||
return Encoding.UTF8.GetString(r);
|
||||
|
||||
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, "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);
|
||||
}
|
||||
|
||||
var r = await client.PostAsync(url, content);
|
||||
return await r.Content.ReadAsStringAsync();
|
||||
// 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, "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);
|
||||
// }
|
||||
//
|
||||
// var r = await client.PostAsync(url, content);
|
||||
// return await r.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
private static Dictionary<string, string> InitRequest(string url, string body, string key, string secret)
|
||||
|
||||
Reference in New Issue
Block a user