如何在C#中发布x-www-form-urlencoded xml请求正文?

时间:2019-06-14 10:33:21

标签: c# xml restsharp

我们如何在C#中使用RestSharp发布x-www-form-urlencoded正文?

我尝试使用AddParameters,并已将Content-Type提供为“ application / x-www-form-urlencoded”,但确实找到了好运。

request.AddParamter("application/x-www-form-urlencoded","grant_type","password",ParameterType.RequestBody);
request.AddParamter("application/x-www-form-urlencoded","username","username",ParameterType.RequestBody);
request.AddParamter("application/x-www-form-urlencoded","password","password",ParameterType.RequestBody);
request.AddParamter("application/x-www-form-urlencoded","clientId","clientId",ParameterType.RequestBody);
request.AddParamter("application/x-www-form-urlencoded","clientsecret","clientsecret",ParameterType.RequestBody);

我收到unsupported_grant_type错误。理想情况下,我们应该在适当的响应下创建201。

0 个答案:

没有答案