1
我有这样的API调用:如何找出字典对象中键的值?
HttpResponse<string> response =
Unirest.get("https://wordsapiv1.p.mashape.com/words/" + word.Name)
.header("X-Mashape-Key", "xxxx")
.header("Accept", "application/json")
.asJson<string>();
下面是HttpResponse
类:
public class HttpResponse<T>
{
public HttpResponse(HttpResponseMessage response);
public T Body { get; set; }
public int Code { get; }
public Dictionary<string, string> Headers { get; }
public Stream Raw { get; }
}
我没有问题得到机构(response.Body
)或代码,但我想做些什么是得到这个标头:
[7] = {[X-RateLimit-requests-Remaining, 2498]}
有人可以告诉我怎么可以检查返回的响应,并找出值的X-RateLimit-requests-Remaining
?
如何:'response.Headers [“X-RateLimit - 请求 - 剩余“]'?所以你知道字典是如何工作的吗? – ckruczek
这是什么'Unirest',为什么它的方法不遵循.NET命名约定? –
@MattiVirkkunen这是一个[轻量级的HTTP请求库](http://unirest.io/net.html),命名可能是由于兼容性原因与其他支持的语言。 –