Answer the question
In order to leave comments, you need to log in
How to force $resource to send data in plain text?
There is a resource
this.Subscription = $resource(apiHost + 'subscription', {}, {});
There is a method that calls it
this.API.Subscription.post({email:email}).$promise
As a result, such a request goes to the server
curl 'https://api.site.com/api/subscription' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json;charset=UTF-8' -H 'Accept: application/json, text/plain, */*' -H 'Connection: keep-alive' --data-binary '{"email":"[email protected]"}' --compressed
curl -X POST --header "Content-Type: application/x-www-form-urlencoded" --header "Accept: application/json" -d "email=kotulskiy%40mlsdev.com" "https://api.site.com//api/subscription"
Answer the question
In order to leave comments, you need to log in
this.Subscription = $resource(apiHost + 'subscription', {}, {
create: {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
transformRequest(data) {
var str = [];
for (var d in data)
str.push(`${encodeURIComponent(d)}=${encodeURIComponent(data[d])}`);
return str.join("&");
}
},
});
this.API.Subscription.create({email:email}).$promise
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question