File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11( function ( root , factory ) {
22 // https://github.com/umdjs/umd/blob/master/templates/returnExports.js
33 if ( typeof define === 'function' && define . amd ) {
4- define ( [ 'angular ' , 'lodash ' ] , factory ) ;
4+ define ( [ 'lodash ' , 'angular ' ] , factory ) ;
55 } else if ( typeof module === 'object' && module . exports ) {
6- module . exports = factory ( require ( 'angular ' ) , require ( 'lodash ' ) ) ;
6+ module . exports = factory ( require ( 'lodash ' ) , require ( 'angular ' ) ) ;
77 } else {
88 // No global export, Restangular will register itself as Angular.js module
99 factory ( root . _ , root . angular ) ;
@@ -648,7 +648,7 @@ restangular.provider('Restangular', function() {
648648 Path . prototype = new BaseCreator ( ) ;
649649
650650 Path . prototype . normalizeUrl = function ( url ) {
651- var parts = / ( h t t p [ s ] ? : \/ \/ ) ? ( .* ) ? / . exec ( url ) ;
651+ var parts = / ( (?: h t t p [ s ] ? : ) ? \/ \/ ) ? ( .* ) ? / . exec ( url ) ;
652652 parts [ 2 ] = parts [ 2 ] . replace ( / [ \\ \/ ] + / g, '/' ) ;
653653 return ( typeof parts [ 1 ] !== 'undefined' ) ? parts [ 1 ] + parts [ 2 ] : parts [ 2 ] ;
654654 } ;
Original file line number Diff line number Diff line change @@ -1149,5 +1149,16 @@ describe("Restangular", function() {
11491149
11501150 $httpBackend . flush ( ) ;
11511151 } ) ;
1152+
1153+ it ( "Should work with absolute URL with //authority" , function ( ) {
1154+ var newRes = Restangular . withConfig ( function ( RestangularConfigurer ) {
1155+ RestangularConfigurer . setBaseUrl ( '//localhost:8080' ) ;
1156+ } ) ;
1157+ expect ( newRes . configuration . baseUrl ) . toEqual ( '//localhost:8080' ) ;
1158+ newRes . all ( "customers////" ) . getList ( ) ;
1159+ $httpBackend . expectGET ( '//localhost:8080/customers/' ) . respond ( [ ] ) ;
1160+
1161+ $httpBackend . flush ( ) ;
1162+ } ) ;
11521163 } ) ;
11531164} ) ;
You can’t perform that action at this time.
0 commit comments