@@ -615,7 +615,7 @@ function $HttpProvider() {
615
615
* - **data** – `{string|Object}` – Data to be sent as the request message data.
616
616
* - **headers** – `{Object}` – Map of strings or functions which return strings representing
617
617
* HTTP headers to send to the server. If the return value of a function is null, the
618
- * header will not be sent.
618
+ * header will not be sent. Functions accept a config object as an argument.
619
619
* - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.
620
620
* - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.
621
621
* - **transformRequest** –
@@ -834,12 +834,12 @@ function $HttpProvider() {
834
834
: $q . reject ( resp ) ;
835
835
}
836
836
837
- function executeHeaderFns ( headers ) {
837
+ function executeHeaderFns ( headers , config ) {
838
838
var headerContent , processedHeaders = { } ;
839
839
840
840
forEach ( headers , function ( headerFn , header ) {
841
841
if ( isFunction ( headerFn ) ) {
842
- headerContent = headerFn ( ) ;
842
+ headerContent = headerFn ( config ) ;
843
843
if ( headerContent != null ) {
844
844
processedHeaders [ header ] = headerContent ;
845
845
}
@@ -873,7 +873,7 @@ function $HttpProvider() {
873
873
}
874
874
875
875
// execute if header value is a function for merged headers
876
- return executeHeaderFns ( reqHeaders ) ;
876
+ return executeHeaderFns ( reqHeaders , shallowCopy ( config ) ) ;
877
877
}
878
878
}
879
879
0 commit comments