I'm not able to add a custom HTTP header in the GET queries in my angularJS application. I'm trying to add a custom header like toto : testing value
into a http get call in AngularJS.
I tried the following:
$http.get('http://www.google.com',{headers : {'toto' : 'test value'}});
I also tried a solution using $http.default.header.common
but it leads to the same result and the result is:
Access-Control-Request-Headers: toto
It modifies the value of the Access-Control-Request-Headers ? What do I misunderstand here? Any idea of how I can achieve that?
var req = { method: "GET", url: "http://example.com", headers: { "Content-Type": "plain/text" } } $http(req).then(function(){...}, function(){...});