From 73db22c76a3e03be9cee30de534cab1daf7e24c8 Mon Sep 17 00:00:00 2001 From: Ken Xu Date: Sun, 1 Sep 2024 17:40:47 +0800 Subject: [PATCH 1/2] Update index.js --- src/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index fb9007ac0..e9d1af055 100644 --- a/src/index.js +++ b/src/index.js @@ -521,7 +521,11 @@ function honoWrapper(compiler, options) { /** * @returns {string | undefined} */ - req.getURL = () => c.req.url; + req.getURL = () => { + // use c.set,because c.req.url read only! + const reqUrl = c.get('c_req_url'); + return reqUrl ? reqUrl : c.req.url; + } let { status } = c.res; From f76c97d9329cd5e9451d2d865b3186902ffc8bbd Mon Sep 17 00:00:00 2001 From: xuhongbin Date: Mon, 2 Sep 2024 10:48:10 +0800 Subject: [PATCH 2/2] feat: add c.req.url set --- src/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index e9d1af055..82d318f8f 100644 --- a/src/index.js +++ b/src/index.js @@ -522,10 +522,10 @@ function honoWrapper(compiler, options) { * @returns {string | undefined} */ req.getURL = () => { - // use c.set,because c.req.url read only! - const reqUrl = c.get('c_req_url'); - return reqUrl ? reqUrl : c.req.url; - } + // @ts-ignore + const url = c.get("c.req.url"); + return url || c.req.url; + }; let { status } = c.res;