angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Request Interceptors should be able to add custom headers to the http request

Open jasadams opened this issue 13 years ago • 1 comments

Currently it is possible to add a request interceptor and modify the config object for a http request before it is sent. I am able to add custom headers to the config object within an interceptor however these headers get ignored when the http request is constructed. I was able to fix this in my own fork by modifying the following line in the "serverRequest" function from:

var reqData = transformData(config.data, headersGetter(headers), config.transformRequest);

to:

var reqData = transformData(config.data, headersGetter(extend(headers,config.headers)), config.transformRequest);

jasadams avatar Apr 11 '13 19:04 jasadams

Closed this issue and opened pull request #2770

jasadams avatar May 23 '13 18:05 jasadams