Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[minor] add other restricted chars
  • Loading branch information
Swaagie committed Dec 16, 2014
1 parent 7fcf632 commit 34bea30
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build/director.js
Expand Up @@ -341,7 +341,7 @@ function paramifyString(str, params, mod) {
}
}
}
return mod === str ? "([._a-zA-Z0-9-]+)" : mod;
return mod === str ? "([._a-zA-Z0-9-%\(\)]+)" : mod;
}

function regifyString(str, params) {
Expand Down
2 changes: 1 addition & 1 deletion lib/director/router.js
Expand Up @@ -84,7 +84,7 @@ function paramifyString(str, params, mod) {
}

return mod === str
? '([._a-zA-Z0-9-%]+)'
? '([._a-zA-Z0-9-%\(\)]+)'
: mod;
}

Expand Down
2 changes: 1 addition & 1 deletion test/server/core/mount-test.js
Expand Up @@ -71,7 +71,7 @@ vows.describe('director/core/mount').addBatch({
assertRoute(foobar, ['foo', 'jitsu', 'then', 'before'], router.routes);
assertRoute(foobazzbuzz, ['foo', 'bazz', 'buzz', 'on'], router.routes);
assertRoute(foostar, ['foo', 'jitsu', 'then', 'now', 'on'], router.routes);
assertRoute(foodog, ['foo', '([._a-zA-Z0-9-%]+)', 'on'], router.routes);
assertRoute(foodog, ['foo', '([._a-zA-Z0-9-%\(\)]+)', 'on'], router.routes);
},

"should accept string path": function(router) {
Expand Down
2 changes: 1 addition & 1 deletion test/server/core/path-test.js
Expand Up @@ -34,7 +34,7 @@ vows.describe('director/core/path').addBatch({

assert.isFunction(router.routes.foo.on);
assert.isObject(router.routes.regions);
assert.isFunction(router.routes.regions['([._a-zA-Z0-9-%]+)'].on);
assert.isFunction(router.routes.regions['([._a-zA-Z0-9-%\(\)]+)'].on);
},
"should dispatch the function correctly": function (router) {
router.dispatch('on', '/regions/newyork')
Expand Down
10 changes: 10 additions & 0 deletions test/server/http/http-test.js
Expand Up @@ -74,6 +74,16 @@ vows.describe('director/http').addBatch({
assert.equal(body, 'hello from (something%40example.com)');
}
},
"an encoded request to add/:param/bark with additional special characters": {
topic: function () {
request({ uri: 'http://localhost:9090/add/something%40(example).com/bark' }, this.callback);
},
'should respond and parse the params': function (err, res, body) {
assert.isNull(err);
assert.equal(res.statusCode, 200);
assert.equal(body, 'hello from (something%40(example).com)');
}
},
"a request to foo/%RT": macros.assert404(9090, 'foo/%RT'),
"a request to /v2/somepath": macros.assertGet(
9090,
Expand Down

0 comments on commit 34bea30

Please sign in to comment.