fix: only collect errors which route path was matched (#4673)

This commit is contained in:
howel52
2020-05-08 11:27:48 +08:00
committed by GitHub
parent 283468d43a
commit 3e846e6919
3 changed files with 8 additions and 8 deletions

View File

@@ -14,9 +14,9 @@ module.exports = async (ctx, next) => {
await next();
if (!ctx.debug.routes[ctx._matchedRoute]) {
ctx.debug.routes[ctx._matchedRoute] = 0;
ctx._matchedRoute && (ctx.debug.routes[ctx._matchedRoute] = 0);
}
ctx.debug.routes[ctx._matchedRoute]++;
ctx._matchedRoute && ctx.debug.routes[ctx._matchedRoute]++;
if (ctx.response.get('X-Koa-Redis-Cache') || ctx.response.get('X-Koa-Memory-Cache')) {
ctx.debug.hitCache++;