@nxtedition/nxt-undici 4.1.1 → 4.1.2

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.
@@ -6,7 +6,7 @@ class CacheHandler extends DecoratorHandler {
6
6
  #handler
7
7
  #store
8
8
  #key
9
- #value
9
+ #value = null
10
10
 
11
11
  constructor({ key, handler, store }) {
12
12
  super(handler)
@@ -65,7 +65,6 @@ export default (interceptorOpts) => (dispatch) => (opts, handler) => {
65
65
 
66
66
  const callback = (err, val) => {
67
67
  if (err) {
68
- handler.onConnect(() => {})
69
68
  handler.onError(err)
70
69
  } else {
71
70
  const url = new URL(opts.origin)
@@ -88,7 +87,6 @@ export default (interceptorOpts) => (dispatch) => (opts, handler) => {
88
87
  )
89
88
  }
90
89
  } catch (err) {
91
- handler.onConnect(() => {})
92
90
  handler.onError(err)
93
91
  }
94
92
 
@@ -3,10 +3,11 @@ import { DecoratorHandler, parseHeaders } from '../utils.js'
3
3
  class Handler extends DecoratorHandler {
4
4
  #handler
5
5
  #opts
6
- #abort
7
- #aborted = false
8
6
  #logger
9
- #pos
7
+
8
+ #abort = null
9
+ #aborted = false
10
+ #pos = 0
10
11
  #timing = {
11
12
  created: performance.now(),
12
13
  connect: -1,
@@ -7,7 +7,6 @@ export default (opts) => (dispatch) => (opts, handler) => {
7
7
 
8
8
  const callback = (err, origin) => {
9
9
  if (err) {
10
- handler.onConnect(() => {})
11
10
  handler.onError(err)
12
11
  } else {
13
12
  dispatch({ ...opts, origin }, handler)
@@ -6,15 +6,15 @@ const redirectableStatusCodes = [300, 301, 302, 303, 307, 308]
6
6
  class Handler extends DecoratorHandler {
7
7
  #dispatch
8
8
  #handler
9
-
10
9
  #opts
11
- #abort
12
- #aborted = false
13
- #reason
14
10
  #maxCount
11
+
12
+ #abort = null
13
+ #aborted = false
14
+ #reason = null
15
15
  #headersSent = false
16
16
  #count = 0
17
- #location
17
+ #location = null
18
18
  #history = []
19
19
 
20
20
  constructor(opts, { dispatch, handler }) {
@@ -12,7 +12,6 @@ export default (opts) => (dispatch) => (opts, handler) => {
12
12
  dispatch({ ...opts, body }, handler)
13
13
  })
14
14
  .catch((err) => {
15
- handler.onConnect(() => {})
16
15
  handler.onError(err)
17
16
  })
18
17
  return true
@@ -20,7 +19,6 @@ export default (opts) => (dispatch) => (opts, handler) => {
20
19
  return dispatch({ ...opts, body }, handler)
21
20
  }
22
21
  } catch (err) {
23
- handler.onConnect(() => {})
24
22
  handler.onError(err)
25
23
  return true
26
24
  }
@@ -4,12 +4,12 @@ import { DecoratorHandler, parseHeaders } from '../utils.js'
4
4
  class Handler extends DecoratorHandler {
5
5
  #handler
6
6
 
7
- #statusCode
8
- #contentType
9
- #decoder
10
- #headers
11
- #body
12
- #errored
7
+ #statusCode = 0
8
+ #contentType = null
9
+ #decoder = null
10
+ #headers = null
11
+ #body = ''
12
+ #errored = false
13
13
 
14
14
  constructor(opts, { handler }) {
15
15
  super(handler)
@@ -17,14 +17,14 @@ class Handler extends DecoratorHandler {
17
17
  #headersSent = false
18
18
  #errorSent = false
19
19
 
20
- #abort
20
+ #abort = null
21
21
  #aborted = false
22
22
  #reason = null
23
23
 
24
- #pos
25
- #end
26
- #etag
27
- #error
24
+ #pos = null
25
+ #end = null
26
+ #etag = null
27
+ #error = null
28
28
 
29
29
  constructor(opts, { handler, dispatch }) {
30
30
  super(handler)
@@ -8,11 +8,11 @@ class Handler extends DecoratorHandler {
8
8
  #handler
9
9
 
10
10
  #verifyOpts
11
- #contentMD5
12
- #contentLength
13
- #hasher
14
- #pos
15
- #errored
11
+ #contentMD5 = null
12
+ #contentLength = null
13
+ #hasher = null
14
+ #pos = 0
15
+ #errored = false
16
16
 
17
17
  constructor(opts, { handler }) {
18
18
  super(handler)
@@ -74,9 +74,7 @@ class Handler extends DecoratorHandler {
74
74
  }
75
75
 
76
76
  onError(err) {
77
- if (this.#errored) {
78
- // Do nothing...
79
- } else {
77
+ if (!this.#errored) {
80
78
  this.#handler.onError(err)
81
79
  }
82
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "4.1.1",
3
+ "version": "4.1.2",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",