alemonjs 2.1.83-alpha.5 → 2.1.83-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -115,9 +115,24 @@ const dispatchRegisteredKoaRouters = async (ctx) => {
115
115
  try {
116
116
  const matchedContext = ctx;
117
117
  const beforeMatched = Array.isArray(matchedContext.matched) ? matchedContext.matched.length : 0;
118
- await koaRouter.routes()(ctx, async () => { });
118
+ const beforeStatus = ctx.status;
119
+ const beforeBody = ctx.body;
120
+ const beforeMatchedRoute = ctx._matchedRoute;
121
+ const beforeRouterPath = ctx.routerPath;
122
+ let fallthrough = false;
123
+ await koaRouter.routes()(ctx, async () => {
124
+ fallthrough = true;
125
+ });
119
126
  const afterMatched = Array.isArray(matchedContext.matched) ? matchedContext.matched.length : 0;
120
- if (afterMatched <= beforeMatched) {
127
+ const afterMatchedRoute = ctx._matchedRoute;
128
+ const afterRouterPath = ctx.routerPath;
129
+ const handled = afterMatched > beforeMatched
130
+ || afterMatchedRoute !== beforeMatchedRoute
131
+ || afterRouterPath !== beforeRouterPath
132
+ || ctx.status !== beforeStatus
133
+ || ctx.body !== beforeBody
134
+ || !fallthrough;
135
+ if (!handled) {
121
136
  continue;
122
137
  }
123
138
  await koaRouter.allowedMethods()(ctx, async () => { });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "2.1.83-alpha.5",
3
+ "version": "2.1.83-alpha.6",
4
4
  "description": "bot script",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",