From 61bee9f65115771c307519a1dee1281365850b45 Mon Sep 17 00:00:00 2001 From: EdamAmex <121654029+EdamAme-x@users.noreply.github.com> Date: Sat, 9 Nov 2024 16:02:21 +0900 Subject: [PATCH] refactor(hono-base): remove unneeded processes and variables (#3649) --- src/hono-base.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hono-base.ts b/src/hono-base.ts index 95de4953..df782b97 100644 --- a/src/hono-base.ts +++ b/src/hono-base.ts @@ -133,9 +133,7 @@ class Hono { - if (typeof handler !== 'string') { - this.#addRoute(method, this.#path, handler) - } + this.#addRoute(method, this.#path, handler) }) return this as any } @@ -489,15 +487,17 @@ class Hono => { if (input instanceof Request) { - if (requestInit !== undefined) { - input = new Request(input, requestInit) - } - return this.fetch(input, Env, executionCtx) + return this.fetch(requestInit ? new Request(input, requestInit) : input, Env, executionCtx) } input = input.toString() - const path = /^https?:\/\//.test(input) ? input : `http://localhost${mergePath('/', input)}` - const req = new Request(path, requestInit) - return this.fetch(req, Env, executionCtx) + return this.fetch( + new Request( + /^https?:\/\//.test(input) ? input : `http://localhost${mergePath('/', input)}`, + requestInit + ), + Env, + executionCtx + ) } /**