Permalink
Browse files

moved fn.params to route.params

  • Loading branch information...
1 parent 83c2c17 commit fda1bc4630d467e573412610f1c79111075ef6ca @tj tj committed Apr 26, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −5 lib/router/index.js
  2. +0 −1 lib/router/route.js
View
@@ -99,7 +99,7 @@ function router(fn){
var i = 0
, keys = route.keys;
- req.params = route.callback.params;
+ req.params = route.params;
// Param preconditions
(function param(err) {
@@ -285,18 +285,19 @@ function match(req, routes, i) {
, fn = route.callback
, path = route.regexp
, keys = route.keys;
+
+ // match
if (captures = path.exec(pathname)) {
- fn.method = method;
- fn.params = [];
+ route.params = [];
for (var j = 1, l = captures.length; j < l; ++j) {
var key = keys[j-1],
val = 'string' == typeof captures[j]
? decodeURIComponent(captures[j])
: captures[j];
if (key) {
- fn.params[key] = val;
+ route.params[key] = val;
} else {
- fn.params.push(val);
+ route.params.push(val);
}
}
req._route_index = i;
View
@@ -26,7 +26,6 @@ function Route(method, path, fn) {
this.path = path;
this.regexp = normalize(path, this.keys = []);
this.method = method;
- this.params = [];
}
/**

0 comments on commit fda1bc4

Please sign in to comment.