Reputation: 862
I would change the content-type in http- interceptor for the method ' request' ?
I tried the following method without success :
config.headers[Content-Type] = 'application/json, text/plain';
Is there a solution ?
code :
'request': function(config) {
config.headers[Content-Type] = 'application/json, text/plain';
return config || $q.when(config);
},
Thank you in advance for your answers !
Upvotes: 0
Views: 803
Reputation: 7405
You need to wrap the array reference key with quotes like
config.headers['Content-Type']
for it to work.
Upvotes: 1
Reputation: 940
Maybe you forgot to register your interceptor with $httpProvider?
angular.module('myApp', [])
.config(function($httpProvider) {
$httpProvider.interceptors.push('myInterceptor');
});
Upvotes: 0