Skip to content

Commit

Permalink
fix request's baseUrl in autoRouter
Browse files Browse the repository at this point in the history
  • Loading branch information
ssddi456 committed Apr 28, 2017
1 parent dd1a6ac commit 02bc094
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/dispatcher/dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module.exports = function (options) {
debuglog('actually get router [%s]', router.__name__);
if (router.__name__ === routerName && req.params.router) {
req.url = shiftUrl(req.url);
req.baseUrl = (req.baseUrl || '') + '/' + routerName;
debuglog('router is matched, remove router from url [%s]', req.url);
}
debuglog('[%s] lookup for user defined router', req.url);
Expand Down Expand Up @@ -88,6 +89,7 @@ module.exports = function (options) {
debuglog('actually get action [%s]', action.__name__);
if (action.__name__ === actionName && req.params.action) {
req.url = shiftUrl(req.url);
req.baseUrl = (req.baseUrl || '') + '/' + actionName;
debuglog('action is matched, remove action from url [%s]', req.url);
}
action(req, res, next);
Expand Down

0 comments on commit 02bc094

Please sign in to comment.