@@ -2213,7 +2213,9 @@ describe('$http', function() {
2213
2213
var $httpBackend ;
2214
2214
2215
2215
beforeEach ( module ( function ( $httpProvider ) {
2216
- $httpProvider . xsrfWhitelistedOrigins . push ( 'https://whitelisted.example.com/' ) ;
2216
+ $httpProvider . xsrfWhitelistedOrigins . push (
2217
+ 'https://whitelisted.example.com' ,
2218
+ 'https://whitelisted2.example.com:1337/ignored/path' ) ;
2217
2219
} ) ) ;
2218
2220
2219
2221
beforeEach ( inject ( function ( _$http_ , _$httpBackend_ ) {
@@ -2308,15 +2310,19 @@ describe('$http', function() {
2308
2310
function checkHeaders ( headers ) {
2309
2311
return isUndefined ( headers [ 'X-XSRF-TOKEN' ] ) ;
2310
2312
}
2311
- var currentUrl = 'https://example.com/path' ;
2312
- var requestUrl = 'https://api.example.com/path' ;
2313
+ var requestUrls = [
2314
+ 'https://api.example.com/path' ,
2315
+ 'http://whitelisted.example.com' ,
2316
+ 'https://whitelisted2.example.com:1338'
2317
+ ] ;
2313
2318
2314
2319
mockedCookies [ 'XSRF-TOKEN' ] = 'secret' ;
2315
- $httpBackend . expect ( 'GET' , requestUrl , null , checkHeaders ) . respond ( null ) ;
2316
2320
2317
- $http . get ( requestUrl ) ;
2318
-
2319
- $httpBackend . flush ( ) ;
2321
+ requestUrls . forEach ( function ( url ) {
2322
+ $httpBackend . expect ( 'GET' , url , null , checkHeaders ) . respond ( null ) ;
2323
+ $http . get ( url ) ;
2324
+ $httpBackend . flush ( ) ;
2325
+ } ) ;
2320
2326
} ) ;
2321
2327
2322
2328
@@ -2326,16 +2332,19 @@ describe('$http', function() {
2326
2332
return headers [ 'X-XSRF-TOKEN' ] === 'secret' ;
2327
2333
}
2328
2334
var currentUrl = 'https://example.com/path' ;
2329
- var requestUrl = 'https://whitelisted.example.com/path' ;
2335
+ var requestUrls = [
2336
+ 'https://whitelisted.example.com/path' ,
2337
+ 'https://whitelisted2.example.com:1337/path'
2338
+ ] ;
2330
2339
2331
2340
$browser . url ( currentUrl ) ;
2332
-
2333
2341
mockedCookies [ 'XSRF-TOKEN' ] = 'secret' ;
2334
- $httpBackend . expect ( 'GET' , requestUrl , null , checkHeaders ) . respond ( null ) ;
2335
2342
2336
- $http . get ( requestUrl ) ;
2337
-
2338
- $httpBackend . flush ( ) ;
2343
+ requestUrls . forEach ( function ( url ) {
2344
+ $httpBackend . expect ( 'GET' , url , null , checkHeaders ) . respond ( null ) ;
2345
+ $http . get ( url ) ;
2346
+ $httpBackend . flush ( ) ;
2347
+ } ) ;
2339
2348
} )
2340
2349
) ;
2341
2350
} ) ;
0 commit comments