@@ -321,11 +321,51 @@ describe('basic usage', function() {
321
321
} ) ;
322
322
323
323
it ( 'should support IPv6 URLs' , function ( ) {
324
- var R = $resource ( 'http://[2620:0:861:ed1a::1]/:ed1a/' , { } , { } , { stripTrailingSlashes : false } ) ;
325
- $httpBackend . expect ( 'GET' , 'http://[2620:0:861:ed1a::1]/foo/' ) . respond ( { } ) ;
326
- $httpBackend . expect ( 'GET' , 'http://[2620:0:861:ed1a::1]/' ) . respond ( { } ) ;
327
- R . get ( { ed1a : 'foo' } ) ;
328
- R . get ( { } ) ;
324
+ var keepSlashes = { stripTrailingSlashes : false } ;
325
+
326
+ var R1 = $resource ( 'http://[2620:0:861:ed1a::1]' , null , null , keepSlashes ) ;
327
+ var R2 = $resource ( 'http://[2620:0:861:ed1a::1]/' , null , null , keepSlashes ) ;
328
+ var R3 = $resource ( 'http://[2620:0:861:ed1a::1]/:ed1a' , null , null , keepSlashes ) ;
329
+ var R4 = $resource ( 'http://[2620:0:861:ed1a::1]/:ed1a/' , null , null , keepSlashes ) ;
330
+
331
+ $httpBackend . expect ( 'GET' , 'http://[2620:0:861:ed1a::1]' ) . respond ( null ) ; // R1
332
+ $httpBackend . expect ( 'GET' , 'http://[2620:0:861:ed1a::1]/' ) . respond ( null ) ; // R2
333
+ $httpBackend . expect ( 'GET' , 'http://[2620:0:861:ed1a::1]/foo' ) . respond ( null ) ; // R3
334
+ $httpBackend . expect ( 'GET' , 'http://[2620:0:861:ed1a::1]/' ) . respond ( null ) ; // R3
335
+ $httpBackend . expect ( 'GET' , 'http://[2620:0:861:ed1a::1]/foo/' ) . respond ( null ) ; // R4
336
+ $httpBackend . expect ( 'GET' , 'http://[2620:0:861:ed1a::1]/' ) . respond ( null ) ; // R4
337
+
338
+ R1 . get ( { ed1a : 'foo' } ) ;
339
+ R2 . get ( { ed1a : 'foo' } ) ;
340
+ R3 . get ( { ed1a : 'foo' } ) ;
341
+ R3 . get ( { } ) ;
342
+ R4 . get ( { ed1a : 'foo' } ) ;
343
+ R4 . get ( { } ) ;
344
+ } ) ;
345
+
346
+ it ( 'should support params in the `hostname` part of the URL' , function ( ) {
347
+ var keepSlashes = { stripTrailingSlashes : false } ;
348
+
349
+ var R1 = $resource ( 'http://:hostname' , null , null , keepSlashes ) ;
350
+ var R2 = $resource ( 'http://:hostname/' , null , null , keepSlashes ) ;
351
+ var R3 = $resource ( 'http://:l2Domain.:l1Domain' , null , null , keepSlashes ) ;
352
+ var R4 = $resource ( 'http://:l2Domain.:l1Domain/' , null , null , keepSlashes ) ;
353
+ var R5 = $resource ( 'http://127.0.0.:octet' , null , null , keepSlashes ) ;
354
+ var R6 = $resource ( 'http://127.0.0.:octet/' , null , null , keepSlashes ) ;
355
+
356
+ $httpBackend . expect ( 'GET' , 'http://foo.com' ) . respond ( null ) ; // R1
357
+ $httpBackend . expect ( 'GET' , 'http://foo.com/' ) . respond ( null ) ; // R2
358
+ $httpBackend . expect ( 'GET' , 'http://bar.com' ) . respond ( null ) ; // R3
359
+ $httpBackend . expect ( 'GET' , 'http://bar.com/' ) . respond ( null ) ; // R4
360
+ $httpBackend . expect ( 'GET' , 'http://127.0.0.42' ) . respond ( null ) ; // R5
361
+ $httpBackend . expect ( 'GET' , 'http://127.0.0.42/' ) . respond ( null ) ; // R6
362
+
363
+ R1 . get ( { hostname : 'foo.com' } ) ;
364
+ R2 . get ( { hostname : 'foo.com' } ) ;
365
+ R3 . get ( { l1Domain : 'com' , l2Domain : 'bar' } ) ;
366
+ R4 . get ( { l1Domain : 'com' , l2Domain : 'bar' } ) ;
367
+ R5 . get ( { octet : 42 } ) ;
368
+ R6 . get ( { octet : 42 } ) ;
329
369
} ) ;
330
370
331
371
it ( 'should support overriding provider default trailing-slash stripping configuration' , function ( ) {
0 commit comments