У меня есть код ниже на С#, который использует RestClient. Проблема в том, что заголовки не должны быть чувствительны к регистру, но выглядят так, как будто они есть.
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 (в верхнем регистре) работает нормально. Нет, ошибка в отношении типа содержимого. Я не могу понять, связана ли проблема со службой, которую она пытается вызвать, или с самим RestClient.
Это код состояния, который я получаю (без исключений) «NotAcceptable Content-Type»