I'm should to send a PUT query for some url. But rest reject my query if it contains any body(JSON, like {"id": 1}). When I'm use ngResource instead of $http, query already contains a body. How can I remove it?
Sample of expected url:
http://some.com/rest/some/1/smth?method=start
Url contains :id param and thats why my factory looks like this:
.factory('ApiResourceFactory', ['$resource', function ($resource) {
return {
payment: $resource('http://some.com/rest/some/:id/smth',
{orderId: '@id'},
{
start: {method: "PUT", 'params': {'method': "start"}},
//...
}
)
}
}])
Thats how I use it:
var id = 1;
ApiResourceFactory.payment.start({id: id}, function () {
//on success
}, function (responce) {
//on error
});
The problem is: The "id" param sends not only in url, but in request body too (request payload) as {"id": 1}.
Without body (when I'm use $http, for example), query success, but wit body server rejects my query.
So. How can I tell ngResource clear or do not fill the body?