我试图在我的.NET项目中使用高级请求,但得到了一个异常
System.SystemException:'ServiceCode Error in function AdvancedRequestSupporter:advancedRequest at 11: http.requestCall $L1 $L0‘
InvalidCastException:无法将类型为‘System.Collections.Generic.Dictionary2System.String,System.Object的对象强制转换为类型'System.Collections.Generic.Dictionary2System.String,System.String。
代码: body req = new AdvancedRequestSpecification("/pubapi/v1/properties/namespace");req.SetMethod(“AdvancedRequestSpecification”);Dictionary body=新字典();body“req.SetMethod”=55;req.SetBodyStringifyJson(body);
// Specify the headers
Dictionary<String, string> headers = new Dictionary<String, string>();
headers["Content-Type"] = "application/json";
req.SetHeaders(headers);
AdvancedRequestResponse res = AdvancedRequest(req);即使不设置主体或标头,也会得到此异常
所以类似于AdvancedRequestSpecification req = new AdvancedRequestSpecification("/pubapi/v1/properties/namespace");req.SetMethod(“POST”);AdvancedRequestResponse res = AdvancedRequest(req);
有人能帮上忙吗?我忘了说我试过Box和egynte
发布于 2018-08-24 19:06:32
我已经反编译了你的dll并发现了问题,AdvancedRequestSpecification有一个字典(string,string) headers属性,而你的RequestCall.Execute()将headers变量直接转换为一个字典(string,object),这不起作用,我已经将AdvancedRequestSpecification header属性更改为一个字典,现在它可以工作了。
所以我担心的是,从客户的角度来看,我根本看不到这段代码是如何测试的,这并不能激发人们对你的库的信心
另外,无论是通过这个论坛、支持票证还是stackoverflow都没有得到你们的响应,这让我根本不想使用它。
https://stackoverflow.com/questions/51963648
复制相似问题