Skip to content

Commit

Permalink
use requestCache.url instead of urlCacheKey
Browse files Browse the repository at this point in the history
  • Loading branch information
tsctx committed Jan 23, 2024
1 parent 68dab3c commit fae3065
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,17 @@ const newRequestFromIncoming = (
const getRequestCache = Symbol('getRequestCache')
const requestCache = Symbol('requestCache')
const incomingKey = Symbol('incomingKey')
const urlCacheKey = Symbol('urlCacheKey')

const requestPrototype: Record<string | symbol, any> = {
get method() {
return this[incomingKey].method || 'GET'
},

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]() {
Expand Down

0 comments on commit fae3065

Please sign in to comment.