var client = new RestClient($"addres");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", $"id={304}&name={"2020-09-14"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
if (response.StatusCode != HttpStatusCode.OK)
{
Console.WriteLine("Access Token cannot obtain, process terminate");
return null;
}
主要是 请求时候 request.AddParameter(“application/x-www-form-urlencoded”, $“id={304}&name={“2020-09-14”}”, ParameterType.RequestBody); application/x-www-form-urlencoded 的用 $“id={304}&name={“2020-09-14”}”
转载地址 https://www.it1352.com/1760123.html