Permalink
Browse files

[minor] add other restricted chars

  • Loading branch information...
Swaagie committed Dec 16, 2014
1 parent 7fcf632 commit 34bea30fae329707ef9ed1cad2b807894d031b11
Showing with 14 additions and 4 deletions.
  1. +1 −1 build/director.js
  2. +1 −1 lib/director/router.js
  3. +1 −1 test/server/core/mount-test.js
  4. +1 −1 test/server/core/path-test.js
  5. +10 −0 test/server/http/http-test.js
@@ -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) {
@@ -84,7 +84,7 @@ function paramifyString(str, params, mod) {
}

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

@@ -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) {
@@ -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')
@@ -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,

0 comments on commit 34bea30

Please sign in to comment.