我使用 RestSharp 访问服务器 API。
RestClient client = new RestClient(serverUrl);
JObject parameters = new JObject
{
new JProperty("Param1", p1),
new JProperty("Param2", p2)
};
RestRequest request = new RestRequest("/Foo", Method.POST);
request.AddParameter("application/json; charset=UTF-8", parameters, ParameterType.RequestBody);
有没有办法在 RestSharp 中获取 REST 请求的原始 JSON 数据?
最佳答案
目前答案是不。实际请求的所有部分,包括带有查询参数的 URL、正文和 header 仅在 ConfigureHttp
私有(private)方法中构建。
关于c# - 在 RestSharp 中获取 REST 请求的原始 JSON 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47450654/