From c16f1ac70a9b65e891282c8850a041d843350d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kuc=CC=8Ca?= Date: Mon, 9 Apr 2012 20:08:06 +0200 Subject: [PATCH] fix Router, do not skip param rules when no the given param is not present --- src/modules/router.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/modules/router.js b/src/modules/router.js index 24f4e6b..c96c99e 100755 --- a/src/modules/router.js +++ b/src/modules/router.js @@ -129,12 +129,10 @@ var Router = module.exports.Router = Function.inherit(function () { } else { if (Object.getOwnPropertyNames(rules).some(function (key) { var index = param_keys.indexOf(key); - if (index > -1) { - if (!rules[key].test(match[index + 1])) { - return true; - } - params[key] = match[index + 1]; + if (index === -1 || !rules[key].test(match[index + 1])) { + return true; } + params[key] = match[index + 1]; })) { return; }