File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,18 @@ describe('interceptors', function(){
43
43
}
44
44
} ) ;
45
45
46
+ $httpProvider . interceptors . push ( function ( ) {
47
+ var count = 0 ;
48
+ return {
49
+ response : function ( response ) {
50
+ count ++ ;
51
+ response . headers [ 'stateful-anonymous-response-count' ] = count ;
52
+
53
+ return response ;
54
+ }
55
+ }
56
+ } ) ;
57
+
46
58
$httpProvider . interceptors . push ( [ '$q' , function ( $q ) {
47
59
return {
48
60
request : function ( config ) {
@@ -115,6 +127,21 @@ describe('interceptors', function(){
115
127
} ) ;
116
128
} ) ;
117
129
130
+ it ( 'allows for intercepts through stateful anonymous factory' , function ( done ) {
131
+ http ( {
132
+ method : 'GET' ,
133
+ url : 'test-url.com/anonymous-intercept'
134
+ } ) . then ( function ( ) {
135
+ return http ( {
136
+ method : 'GET' ,
137
+ url : 'test-url.com/anonymous-intercept'
138
+ } ) ;
139
+ } ) . then ( function ( response ) {
140
+ expect ( response . headers [ 'stateful-anonymous-response-count' ] ) . toBeGreaterThan ( 1 ) ;
141
+ done ( ) ;
142
+ } ) ;
143
+ } ) ;
144
+
118
145
it ( 'allows for intercepts that return a promise from a request' , function ( done ) {
119
146
http ( {
120
147
method : 'POST' ,
You can’t perform that action at this time.
0 commit comments