From daddd499c111cb2dacd8f35740d889c0a9847864 Mon Sep 17 00:00:00 2001 From: Guillaume Sabran Date: Wed, 1 Jun 2016 01:59:20 -0700 Subject: [PATCH] Fix issue when several routes match current path Currently, doing: ```javascript Picker.route('somePath', (params, req, res, next) => { if (req.method == 'POST') { ... } else { next(); } }); Picker.route('somePath', (params, req, res, next) => { if (req.method == 'GET') { ... } else { next(); } }); ``` will not reach the GET route if the request is `GET somePath`. If you accept the PR, it's be good to update picker's version and the dependency in flow-router-ssr at https://github.com/kadirahq/flow-router/blob/ssr/package.js#L61 --- lib/implementation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/implementation.js b/lib/implementation.js index 194f10c..e91e7d4 100644 --- a/lib/implementation.js +++ b/lib/implementation.js @@ -57,7 +57,7 @@ PickerImp.prototype._dispatch = function(req, res, bypass) { if(m) { var params = self._buildParams(route.keys, m); params.query = urlParse(req.url, true).query; - self._processRoute(route.callback, params, req, res, bypass); + self._processRoute(route.callback, params, req, res, processNextRoute); } else { processNextRoute(); } @@ -109,4 +109,4 @@ PickerImp.prototype._processMiddleware = function(middleware, req, res, next) { function doCall() { middleware.call(null, req, res, next); } -}; \ No newline at end of file +};