[英]API response returns 0 in Postman, but -0.0 when calling from C#
I'm making a call to an API using C# code. 我正在使用C#代码调用API。
I have an API class that has a GET method. 我有一个具有GET方法的API类。 (I admit that I got the code from a colleague and have just adapted it).
(我承认我从同事那里获得了代码,并且刚刚对其进行了修改)。
The ProcessRequest method takes the response from the WebRequest and stores it in a variable called feed
ProcessRequest方法从WebRequest获取响应并将其存储在一个名为
feed
的变量中
When I use the text visualizer to see what is coming back, then I see the item
key-value pair has a -0.0 value. 当我使用文本可视化工具查看返回的内容时,然后看到
item
键值对具有-0.0值。
This unfortunately gives an error when I use Newtonsoft to deserialise into a class that I have defined as this field should be an integer. 不幸的是,当我使用Newtonsoft反序列化为我定义的类时,这会产生错误,因为此字段应为整数。 NOTE: THE ERROR NEWTONSOFT RETURNS IS IRRELEVANT TO ME AT THIS POINT
注意:在这一点上,错误NEWTONSOFT返回与我无关
When I call the API using Postman, this is the result I get back ... 当我使用Postman调用API时,这就是我得到的结果...
You can see that the last
KVP returns an integer value, which is what is expected. 您可以看到
last
KVP返回一个整数值,这是预期值。
Does anyone have any idea of why I am getting a different response in my C# code than I am from Postman, and what I can do about it? 有谁知道为什么我在C#代码中得到的答复与从邮递员那里得到的答复有所不同,我能做什么?
Summary:- C# returns me a -0.0 in the value of that Key-Value pair Postman returns me a 0 in the value of that Key-Value pair 摘要:-C#向我返回该键值对值的-0.0,邮递员向我返回该键值对值的0。
I'm unable to post a working code sample that hits the API as the API is a pay-for service. 由于该API是一项付费服务,因此我无法发布有效的示例代码来访问该API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.