@@ -755,17 +755,19 @@ describe('$http', function() {
755755 } ) ) ;
756756
757757 it ( 'should send execute result if header value is function' , inject ( function ( ) {
758- var headerConfig = { 'Accept' : function ( ) { return 'Rewritten' ; } } ;
758+ var headerConfig = { 'Accept' : function ( config ) { return 'Rewritten-' + config . method ; } } ;
759759
760- function checkHeaders ( headers ) {
761- return headers [ 'Accept' ] == 'Rewritten' ;
760+ function checkHeaders ( method ) {
761+ return function ( headers ) {
762+ return headers [ 'Accept' ] == 'Rewritten-' + method ;
763+ } ;
762764 }
763765
764- $httpBackend . expect ( 'GET' , '/url' , undefined , checkHeaders ) . respond ( '' ) ;
765- $httpBackend . expect ( 'POST' , '/url' , undefined , checkHeaders ) . respond ( '' ) ;
766- $httpBackend . expect ( 'PUT' , '/url' , undefined , checkHeaders ) . respond ( '' ) ;
767- $httpBackend . expect ( 'PATCH' , '/url' , undefined , checkHeaders ) . respond ( '' ) ;
768- $httpBackend . expect ( 'DELETE' , '/url' , undefined , checkHeaders ) . respond ( '' ) ;
766+ $httpBackend . expect ( 'GET' , '/url' , undefined , checkHeaders ( 'GET' ) ) . respond ( '' ) ;
767+ $httpBackend . expect ( 'POST' , '/url' , undefined , checkHeaders ( 'POST' ) ) . respond ( '' ) ;
768+ $httpBackend . expect ( 'PUT' , '/url' , undefined , checkHeaders ( 'PUT' ) ) . respond ( '' ) ;
769+ $httpBackend . expect ( 'PATCH' , '/url' , undefined , checkHeaders ( 'PATCH' ) ) . respond ( '' ) ;
770+ $httpBackend . expect ( 'DELETE' , '/url' , undefined , checkHeaders ( 'DELETE' ) ) . respond ( '' ) ;
769771
770772 $http ( { url : '/url' , method : 'GET' , headers : headerConfig } ) ;
771773 $http ( { url : '/url' , method : 'POST' , headers : headerConfig } ) ;
0 commit comments