From 5136605322f7612df740c38fbd0f01258b82ec17 Mon Sep 17 00:00:00 2001 From: yutent Date: Wed, 27 Dec 2023 10:58:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B7=AF=E7=94=B1=E4=B8=80?= =?UTF-8?q?=E5=A4=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/router/router-engine.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 78fdab8..f230c67 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wkitd", - "version": "1.3.1", + "version": "1.3.2", "type": "module", "main": "dist/index.js", "files": [ diff --git a/src/router/router-engine.js b/src/router/router-engine.js index f4d0bf7..a7489df 100644 --- a/src/router/router-engine.js +++ b/src/router/router-engine.js @@ -64,7 +64,7 @@ class Router { re = route.path.replace( RULE_REGEXP, - function (m, _prefix, _var, _require) { + function (m, _prefix, _var, _require = '') { vars.push(_var.slice(1)) if (_prefix === '/') { _prefix = '/?' @@ -116,6 +116,7 @@ class Router { } for (let [k, route] of this.#tables) { + console.log(route, path.match(route.regexp)) let args = path.match(route.regexp) if (args) { let params = Object.create(null)