0

There is a situation where I am sending a Http Request to my server. The result my server sends is

[{"Data1":"MyData"}]

but the data I am getting on salesforce side from response.getBody() is :

[{"data1":"MyData"}]

As it can be noticed that the first letter of character is changed from capital to small(in case of key 'Data1').

I am using JavaScript remoting, what can be the issue? where i am wrong.

@RemoteAction
global static string GetDetails(string Id){
    HttpRequest req_objects = new HttpRequest();
    req_objects.setMethod('GET');
    req_objects.setEndpoint('https://myDomain.com/Api/Rest/GetDetails?Id='+Id);
    req_objects.setHeader('Authorization', 'Bearer '+token);
    Http http = new Http();
    HTTPResponse res_objects = http.send(req_objects);
    return res_objects.getBody();
}

the res_objects.getBody() is getting changed?

1 Answer 1

0

That happens because HTTP headers are case-insensitive as you can see in the url: https://stackoverflow.com/questions/5258977/are-http-headers-case-sensitive

1
  • But here i am talking about response body Sep 20, 2018 at 13:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .