This is my Resource
this.users = $resource(AppConstants.baseUrl);
This is my interceptor
return {
request : function(config){
if(blackList.indexOf(config.url.index) != -1){ //Skip API which does not demand JSON type
config.headers["Content-Type"] = "application/json";
}
//Delete content type for GET request
if (!config.data) {
console.log('Setting content type')
delete config.headers['Content-Type'];
config.headers["Content-Type"] = "application/json;charset=utf-8";
}
console.log(config)
return config;
},
response : function(response){
return response;
}
};
Now, whenever I make a GET request, the Content-Type is duly removed from Request. I even passed dummy data but still no luck. Unfortunately, my REST API demands Content-Type
to be mentioned explicitly.
What am I missing!