Skip to content
Myr

Fixed route-specific middleware when using the same callback function several times

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 5f0a854 · Browse files · 1 file+2 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−3 removed

  • other:+2 added−3 removed

1 file+2 added−3 removed

modified:lib/router/index.js+2 added-3 removed
77 unmodified lines
78 fn = middleware.pop();79 middleware = utils.flatten(middleware);80 }8182 fn.middleware = middleware;8382 if (!path) throw new Error(name + ' route requires a path');83 if (!fn) throw new Error(name + ' route ' + path + ' requires a callback');8485 var options = { sensitive: app.enabled('case sensitive routes') };86 var route = new Route(name, path, fn, options);87 route.middleware = middleware;88 localRoutes.push(route);89 return self;90 };91 }
35 unmodified lines
127 } else if (!key) {128 // route middleware129 i = 0;130 (function nextMiddleware(err){132 var fn = route.callback.middleware[i++];131 var fn = route.middleware[i++];132 if ('route' == err) {133 pass(req._route_index + 1);134 } else if (err) {135 next(err);
194 unmodified lines