我们如何在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。