@nxtedition/nxt-undici 7.3.22 → 7.3.24
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/interceptor/log.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Readable } from 'node:stream'
|
|
2
2
|
import { isStream } from '../utils.js'
|
|
3
3
|
|
|
4
|
+
function noop() {}
|
|
5
|
+
|
|
4
6
|
class FactoryStream extends Readable {
|
|
5
7
|
#factory
|
|
6
8
|
#ac
|
|
@@ -72,4 +74,4 @@ class FactoryStream extends Readable {
|
|
|
72
74
|
export default () => (dispatch) => (opts, handler) =>
|
|
73
75
|
typeof opts.body !== 'function'
|
|
74
76
|
? dispatch(opts, handler)
|
|
75
|
-
: dispatch({ ...opts, body: new FactoryStream(opts.body) }, handler)
|
|
77
|
+
: dispatch({ ...opts, body: new FactoryStream(opts.body).on('error', noop) }, handler)
|
|
@@ -70,7 +70,7 @@ class Handler extends DecoratorHandler {
|
|
|
70
70
|
|
|
71
71
|
super.onError(
|
|
72
72
|
decorateError(null, this.#opts, {
|
|
73
|
-
statusCode: this.#statusCode,
|
|
73
|
+
statusCode: this.#statusCode || undefined,
|
|
74
74
|
headers: this.#headers,
|
|
75
75
|
trailers: this.#trailers,
|
|
76
76
|
body: this.#body,
|
|
@@ -81,7 +81,7 @@ class Handler extends DecoratorHandler {
|
|
|
81
81
|
onError(err) {
|
|
82
82
|
super.onError(
|
|
83
83
|
decorateError(err, this.#opts, {
|
|
84
|
-
statusCode: this.#statusCode,
|
|
84
|
+
statusCode: this.#statusCode || undefined,
|
|
85
85
|
headers: this.#headers,
|
|
86
86
|
trailers: this.#trailers,
|
|
87
87
|
body: null,
|
|
@@ -261,7 +261,7 @@ class Handler extends DecoratorHandler {
|
|
|
261
261
|
retryPromise = Promise.resolve(
|
|
262
262
|
this.#opts.retry(
|
|
263
263
|
decorateError(err, this.#opts, {
|
|
264
|
-
statusCode: this.#statusCode,
|
|
264
|
+
statusCode: this.#statusCode || undefined,
|
|
265
265
|
headers: this.#headers,
|
|
266
266
|
trailers: this.#trailers,
|
|
267
267
|
body: this.#body,
|