خرید بک لینک

Vote count: 0

I have the code below in c#, which uses RestClient. The issue is that the headers should not be case-sensitive but looks like they are.

var client = new RestClient(sMA_URL);
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");

//Without the line below the RestRequest adds some default header which is not acceptable by our server. 
 request.AddHeader("**Accept**", "*/*");
 request.AddHeader("content-type", "application/json");
 request.AddHeader("authorization", "Bearer "+sBearerToken);

// Make sure you deserialize this response, for further use. The best way to do this is to create a class and then fill that with the values obtained by the response but if a response is not used many times,
// you can do it the way it has been done in Bearer Token Generation

 IRestResponse response = client.Execute(request);

 Console.WriteLine(response.Content);
 Console.ReadKey();

Accept header works but lower case accept does not. I can't figure out if the issue is with the service it's trying to call or with RestClient itself.

asked 8 secs ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 3 تير 1395 ساعت: 13:38

صفحه بندی