From fae306576151905c9acdc886f7aacad6e4cbb79d Mon Sep 17 00:00:00 2001 From: tsctx <91457664+tsctx@users.noreply.github.com> Date: Tue, 23 Jan 2024 21:27:39 +0900 Subject: [PATCH] use `requestCache.url` instead of `urlCacheKey` --- src/request.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/request.ts b/src/request.ts index ab16ff1..3264ea0 100644 --- a/src/request.ts +++ b/src/request.ts @@ -37,7 +37,6 @@ const newRequestFromIncoming = ( const getRequestCache = Symbol('getRequestCache') const requestCache = Symbol('requestCache') const incomingKey = Symbol('incomingKey') -const urlCacheKey = Symbol('urlCacheKey') const requestPrototype: Record = { get method() { @@ -45,10 +44,10 @@ const requestPrototype: Record = { }, get url() { - if (this[urlCacheKey]) return this[urlCacheKey] + if (this[requestCache]) return this[requestCache].url const req = this[incomingKey] const url = `http://${req instanceof Http2ServerRequest ? req.authority : req.headers.host}${req.url}` - return (this[urlCacheKey] = new URL(url).href) + return new URL(url).href }, [getRequestCache]() {