I'm trying to set headers with $resource. It works with GET request, but
doesn't work on post request.
var DiscussionsResource = $resource('https://jsbin.com/my-articles', {}, {
post: {
method: 'POST',
params: {'asdsa':'sss'},
isArray: false,
headers: {Authorization: "Token
5b4447996855da6de109226857ec981dfe2c50a2"},
transformResponse: function(defaults) {
defaults = angular.fromJson(defaults);
console.debug(' -> discussion has been created ',
defaults);
return defaults;
}
}
});
DiscussionsResource.save({});
What is wrong here? It works with $http, it works with $resource get but
doesn't work on $resource post. Here is jsbin for this:
https://jsbin.com/joziniweyi/edit?html,js,console
Happens on 1.4.9, same happens on angular 1.5.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.