I use $resource to send requests to my REST backend. But I have problem sending DELETE requests with the correct header attribute 'Content-Type'.
$resource doesn't let me specify headers (until
https://github.com/angular/angular.js/issues/736 is implemented), but usually it sends data per default as application/json doesn't it? For GET, POST and PUT requests at least it works. But for the following action it doesn't:
$ressource('url').delete([], data);
It sends a DELETE request with the following headers:
Accept:
application/json, text/plain, */*
Accept-Charset:
ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:
gzip,deflate,sdch
Accept-Language:
de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Connection:
keep-alive
Content-Length:
137
Content-Type:
application/xml
Host:
localhost:8080
Origin:
Referer:
User-Agent:
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11
X-Requested-With:
XMLHttpRequest
The important thing is the Content-Type (marked red). As it works with the POST requests flawless, I'm not sure, if that is a bug or it is supposed to work this way? I now just send all the requests with the $http object, but I've hoped there is a better way.
Any clues on that?
Many thanks,
Joel