使用Restsharp的POST无法按预期工作

时间:2017-10-21 01:27:57

标签: restsharp

我有以下代码:

var Client = new System.Net.WebClient();
var Response = Client.UploadString("myurl", PostData);

按预期工作

我正在尝试使用Restsharp:

var Client = new RestClient("myurl");
var Request = new RestRequest(Method.POST);
Request.AddBody(PostData);
var Response = client.Execute(request);

不起作用,并且:

var Client = new RestClient("myurl");
var Request = new RestRequest(Method.POST);
Request.AddParameter("application/x-www-form-urlencoded; charset=UTF-8", PostData);
var Response = client.Execute(request);

也不起作用...... 我错过了什么?

0 个答案:

没有答案