angular.js
angular.js copied to clipboard
Request Interceptors should be able to add custom headers to the http request
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);
Closed this issue and opened pull request #2770