@nxtedition/nxt-undici 7.1.2 → 7.1.4

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/index.js CHANGED
@@ -117,8 +117,9 @@ function wrapDispatch(dispatcher) {
117
117
  signal: opts.signal ?? undefined,
118
118
  reset: opts.reset ?? false,
119
119
  blocking: opts.blocking ?? true,
120
- headersTimeout: opts.timeout?.headers ?? opts.headersTimeout,
121
- bodyTimeout: opts.timeout?.body ?? opts.bodyTimeout,
120
+ headersTimeout:
121
+ opts.timeout?.headers ?? opts.headersTimeout ?? opts.headerTimeout ?? opts.timeout,
122
+ bodyTimeout: opts.timeout?.body ?? opts.bodyTimeout ?? opts.timeout,
122
123
  idempotent: opts.idempotent,
123
124
  retry: opts.retry ?? 8,
124
125
  proxy: opts.proxy ?? false,
@@ -89,7 +89,7 @@ export default () => (dispatch) => {
89
89
  const [err, val] = await resolve(hostname, { ttl })
90
90
 
91
91
  if (err) {
92
- throw Object.assign(new Error('lookup failed: ' + err.message), { cause: err })
92
+ throw err
93
93
  }
94
94
 
95
95
  records = val
@@ -28,9 +28,17 @@ class FactoryStream extends Readable {
28
28
 
29
29
  if (this.#body != null) {
30
30
  this.#body
31
- .on('readable', () => this._read())
32
- .on('end', () => this.push(null))
33
- .on('error', (err) => this.destroy(err))
31
+ .on('data', (data) => {
32
+ if (!this.push(data)) {
33
+ this.pause()
34
+ }
35
+ })
36
+ .on('end', () => {
37
+ this.push(null)
38
+ })
39
+ .on('error', (err) => {
40
+ this.destroy(err)
41
+ })
34
42
  }
35
43
 
36
44
  callback(null)
@@ -43,10 +51,7 @@ class FactoryStream extends Readable {
43
51
  }
44
52
 
45
53
  _read() {
46
- const chunk = this.#body?.read()
47
- if (chunk !== null) {
48
- this.push(chunk)
49
- }
54
+ this.resume()
50
55
  }
51
56
 
52
57
  _destroy(err, callback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "7.1.2",
3
+ "version": "7.1.4",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",