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 9d53e97 commit 407fc86
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 @@ -62,6 +62,7 @@ module.exports = function (options) {
debuglog('actually get router [%s]', router.__name__);
if (router.__name__ === routerName && req.params.router && shiftRouterNameFromUrl) {
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 @@ -93,6 +94,7 @@ module.exports = function (options) {
debuglog('actually get action [%s]', action.__name__);
if (action.__name__ === actionName && req.params.action && shiftRouterNameFromUrl) {
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 407fc86

Please sign in to comment.