0

我正在运行以下代码:

var client = new RestClient();
var request = new RestRequest("https://connect.squareup.com/v1/me/payments", Method.GET) 
{ 
    RequestFormat = DataFormat.Json 
};
request.AddHeader("Authorization", "Bearer XXXXXX");
var Response = client.Execute(request);

响应错误消息指出:

Value cannot be null.
Parameter name: uri

不知道为什么我会收到此错误

4

1 回答 1

1

我目前无法尝试此操作,因此我不确定它是否是您正在寻找的修复程序,但这只是一个想法:尝试RestClient使用 Uri 字符串和字符串RestRequest的其余部分或空字符串初始化, 像这样:

var client = new RestClient("https://connect.squareup.com/v1/me/payments");
var request = new RestRequest("", Method.GET)
{ 
    RequestFormat = DataFormat.Json 
};
request.AddHeader("Authorization", "Bearer XXXXXX");
var Response = client.Execute(request);
于 2015-02-10T13:03:19.657 回答