I am attempting to specify the content-type as application/json for the $resource delete action. The reason behind enforcing the content-type as application/json is due to an issue with IE10 and IE11, which recognize the content-type for DELETE requests as plain/text while other browsers and older versions of IE interpret it as application/json. Unfortunately, there is a constraint from the back end that always requires the content-type to be set as JSON.
My current approach to enforce this is:
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'
}
Despite these efforts, I have not been successful in setting the content-type to JSON.