@nxtedition/nxt-undici 4.1.2 → 4.1.3
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/lib/utils.js +0 -8
- package/package.json +1 -1
package/lib/utils.js
CHANGED
|
@@ -3,8 +3,6 @@ import cacheControlParser from 'cache-control-parser'
|
|
|
3
3
|
import stream from 'node:stream'
|
|
4
4
|
import { util } from '@nxtedition/undici'
|
|
5
5
|
|
|
6
|
-
const noop = () => {}
|
|
7
|
-
|
|
8
6
|
export function parseCacheControl(str) {
|
|
9
7
|
return str ? cacheControlParser.parse(str) : null
|
|
10
8
|
}
|
|
@@ -252,7 +250,6 @@ export function bodyLength(body) {
|
|
|
252
250
|
|
|
253
251
|
export class DecoratorHandler {
|
|
254
252
|
#handler
|
|
255
|
-
#onConnectCalled = false
|
|
256
253
|
|
|
257
254
|
constructor(handler) {
|
|
258
255
|
if (typeof handler !== 'object' || handler === null) {
|
|
@@ -262,15 +259,10 @@ export class DecoratorHandler {
|
|
|
262
259
|
}
|
|
263
260
|
|
|
264
261
|
onConnect(...args) {
|
|
265
|
-
this.#onConnectCalled = true
|
|
266
262
|
return this.#handler.onConnect?.(...args)
|
|
267
263
|
}
|
|
268
264
|
|
|
269
265
|
onError(...args) {
|
|
270
|
-
if (!this.#onConnectCalled) {
|
|
271
|
-
this.#onConnectCalled = true
|
|
272
|
-
this.#handler.onConnect?.(noop)
|
|
273
|
-
}
|
|
274
266
|
return this.#handler.onError?.(...args)
|
|
275
267
|
}
|
|
276
268
|
|