This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 31
31
*
32
32
* @param {string } url A parametrized URL template with parameters prefixed by `:` as in
33
33
* `/user/:username`. If you are using a URL with a port number (e.g.
34
- * `http://example.com:8080/api`), you'll need to escape the colon character before the port
35
- * number, like this: `$resource('http://example.com\\:8080/api')`.
34
+ * `http://example.com:8080/api`), it will be respected.
36
35
*
37
36
* @param {Object= } paramDefaults Default values for `url` parameters. These can be overridden in
38
37
* `actions` methods. If any of the parameter value is a function, it will be executed every time
@@ -331,7 +330,7 @@ angular.module('ngResource', ['ng']).
331
330
332
331
var urlParams = self . urlParams = { } ;
333
332
forEach ( url . split ( / \W / ) , function ( param ) {
334
- if ( param && ( new RegExp ( "(^|[^\\\\]):" + param + "(\\W|$)" ) . test ( url ) ) ) {
333
+ if ( ! ( new RegExp ( "^\\d+" , "g" ) . test ( param ) ) && param && ( new RegExp ( "(^|[^\\\\]):" + param + "(\\W|$)" ) . test ( url ) ) ) {
335
334
urlParams [ param ] = true ;
336
335
}
337
336
} ) ;
Original file line number Diff line number Diff line change @@ -106,6 +106,13 @@ describe("resource", function() {
106
106
R . get ( { a : 'foo' , b : 'bar' } ) ;
107
107
} ) ;
108
108
109
+ it ( 'should support por unescaped url' , function ( ) {
110
+ var R = $resource ( 'http://localhost:8080/Path/:a' ) ;
111
+
112
+ $httpBackend . expect ( 'GET' , 'http://localhost:8080/Path/foo' ) . respond ( ) ;
113
+ R . get ( { a : 'foo' } ) ;
114
+ } ) ;
115
+
109
116
110
117
it ( 'should correctly encode url params' , function ( ) {
111
118
var R = $resource ( '/Path/:a' ) ;
You can’t perform that action at this time.
0 commit comments