@@ -300,11 +300,35 @@ describe('basic usage', function() {
300
300
} ) ;
301
301
302
302
it ( 'should support IPv6 URLs' , function ( ) {
303
- var R = $resource ( 'http://[2620:0:861:ed1a::1]/:ed1a/' , { } , { } , { stripTrailingSlashes : false } ) ;
304
- $httpBackend . expect ( 'GET' , 'http://[2620:0:861:ed1a::1]/foo/' ) . respond ( { } ) ;
305
- $httpBackend . expect ( 'GET' , 'http://[2620:0:861:ed1a::1]/' ) . respond ( { } ) ;
306
- R . get ( { ed1a : 'foo' } ) ;
307
- R . get ( { } ) ;
303
+ test ( 'http://[2620:0:861:ed1a::1]' , { ed1a : 'foo' } , 'http://[2620:0:861:ed1a::1]' ) ;
304
+ test ( 'http://[2620:0:861:ed1a::1]/' , { ed1a : 'foo' } , 'http://[2620:0:861:ed1a::1]/' ) ;
305
+ test ( 'http://[2620:0:861:ed1a::1]/:ed1a' , { ed1a : 'foo' } , 'http://[2620:0:861:ed1a::1]/foo' ) ;
306
+ test ( 'http://[2620:0:861:ed1a::1]/:ed1a' , { } , 'http://[2620:0:861:ed1a::1]/' ) ;
307
+ test ( 'http://[2620:0:861:ed1a::1]/:ed1a/' , { ed1a : 'foo' } , 'http://[2620:0:861:ed1a::1]/foo/' ) ;
308
+ test ( 'http://[2620:0:861:ed1a::1]/:ed1a/' , { } , 'http://[2620:0:861:ed1a::1]/' ) ;
309
+
310
+ // Helpers
311
+ function test ( templateUrl , params , actualUrl ) {
312
+ var R = $resource ( templateUrl , null , null , { stripTrailingSlashes : false } ) ;
313
+ $httpBackend . expect ( 'GET' , actualUrl ) . respond ( null ) ;
314
+ R . get ( params ) ;
315
+ }
316
+ } ) ;
317
+
318
+ it ( 'should support params in the `hostname` part of the URL' , function ( ) {
319
+ test ( 'http://:hostname' , { hostname : 'foo.com' } , 'http://foo.com' ) ;
320
+ test ( 'http://:hostname/' , { hostname : 'foo.com' } , 'http://foo.com/' ) ;
321
+ test ( 'http://:l2Domain.:l1Domain' , { l1Domain : 'com' , l2Domain : 'bar' } , 'http://bar.com' ) ;
322
+ test ( 'http://:l2Domain.:l1Domain/' , { l1Domain : 'com' , l2Domain : 'bar' } , 'http://bar.com/' ) ;
323
+ test ( 'http://127.0.0.:octet' , { octet : 42 } , 'http://127.0.0.42' ) ;
324
+ test ( 'http://127.0.0.:octet/' , { octet : 42 } , 'http://127.0.0.42/' ) ;
325
+
326
+ // Helpers
327
+ function test ( templateUrl , params , actualUrl ) {
328
+ var R = $resource ( templateUrl , null , null , { stripTrailingSlashes : false } ) ;
329
+ $httpBackend . expect ( 'GET' , actualUrl ) . respond ( null ) ;
330
+ R . get ( params ) ;
331
+ }
308
332
} ) ;
309
333
310
334
it ( 'should support overriding provider default trailing-slash stripping configuration' , function ( ) {
0 commit comments