I'm trying to set the content-type as application/json for $resrouce delete action. The only reason that I need to enforce the content-type to application/json is that IE10, and IE11 detects the content-type for DELETE request as plain/text, but all other browsers and older versions of IE detects it as application/json. I have a limitation from back end, which always check for content-type as Json.
Here is how i'm trying to enforce it:
remove: {
method: 'DELETE',
headers: { 'Content-Type': 'application/json; charset=utf-8'},
transformRequest: function(data, headerGetters) {
headerGetters()['Content-Type'] = 'application/json';
return angular.toJson(data);
},
update: {
method: 'PUT'
}
But this still doesn't work and couldn't set the content-type as json.