File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -401,7 +401,7 @@ angular.module('ngResource', ['ng']).
401
401
} ) ;
402
402
403
403
// strip trailing slashes and set the url
404
- url = url . replace ( / \/ + $ / , '' ) ;
404
+ url = url . replace ( / \/ + $ / , '' ) || '/' ;
405
405
// then replace collapse `/.` if found in the last URL path segment before the query
406
406
// E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x`
407
407
url = url . replace ( / \/ \. (? = \w + ( $ | \? ) ) / , '.' ) ;
Original file line number Diff line number Diff line change @@ -150,6 +150,13 @@ describe("resource", function() {
150
150
R . get ( { a :6 , b :7 , c :8 } ) ;
151
151
} ) ;
152
152
153
+ it ( 'should not collapsed the url into an empty string' , function ( ) {
154
+ var R = $resource ( '/:foo/:bar/' ) ;
155
+
156
+ $httpBackend . when ( 'GET' , '/' ) . respond ( '{}' ) ;
157
+
158
+ R . get ( { } ) ;
159
+ } ) ;
153
160
154
161
it ( 'should support escaping colons in url template' , function ( ) {
155
162
var R = $resource ( 'http://localhost\\:8080/Path/:a/\\:stillPath/:b' ) ;
You can’t perform that action at this time.
0 commit comments