@nxtedition/lib 26.0.9 → 26.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cache.js +8 -3
- package/http.js +11 -8
- package/package.json +1 -1
package/cache.js
CHANGED
|
@@ -104,9 +104,14 @@ export class AsyncCache {
|
|
|
104
104
|
)
|
|
105
105
|
this.#delQuery = this.#db.prepare(`DELETE FROM cache WHERE key = ?`)
|
|
106
106
|
} catch (err) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
this.#db?.close()
|
|
108
|
+
this.#db = null
|
|
109
|
+
|
|
110
|
+
this.#getQuery = null
|
|
111
|
+
this.#setQuery = null
|
|
112
|
+
this.#delQuery = null
|
|
113
|
+
|
|
114
|
+
process.emitWarning(err)
|
|
110
115
|
}
|
|
111
116
|
}
|
|
112
117
|
}
|
package/http.js
CHANGED
|
@@ -75,7 +75,7 @@ export class Context {
|
|
|
75
75
|
return this.#req.target
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
this.#target ??= requestTarget(this.#req)
|
|
78
|
+
this.#target ??= Object.freeze(requestTarget(this.#req))
|
|
79
79
|
|
|
80
80
|
if (!this.#target) {
|
|
81
81
|
throw new createError.BadRequest('invalid url')
|
|
@@ -89,13 +89,10 @@ export class Context {
|
|
|
89
89
|
return this.#req.query
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
this.#query ??=
|
|
94
|
-
this.#target.search.length > 1
|
|
95
|
-
? Object.freeze(querystring.parse(this.#target.search.slice(1)))
|
|
96
|
-
: {}
|
|
92
|
+
const search = this.target.search
|
|
97
93
|
|
|
98
|
-
return this.#query
|
|
94
|
+
return (this.#query ??=
|
|
95
|
+
search.length > 1 ? Object.freeze(querystring.parse(search.slice(1))) : {})
|
|
99
96
|
}
|
|
100
97
|
|
|
101
98
|
get userAgent() {
|
|
@@ -373,7 +370,13 @@ export class IncomingMessage extends http.IncomingMessage {
|
|
|
373
370
|
this.#target = undefined
|
|
374
371
|
}
|
|
375
372
|
|
|
376
|
-
|
|
373
|
+
this.#target ??= Object.freeze(requestTarget(this))
|
|
374
|
+
|
|
375
|
+
if (!this.#target) {
|
|
376
|
+
throw new createError.BadRequest('invalid url')
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return this.#target
|
|
377
380
|
}
|
|
378
381
|
|
|
379
382
|
get query() {
|