@nxtedition/lib 26.3.3 → 26.3.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/http.js +12 -8
- package/package.json +1 -1
package/http.js
CHANGED
|
@@ -235,14 +235,6 @@ export async function requestMiddleware(ctx, next) {
|
|
|
235
235
|
|
|
236
236
|
const thenable = next()
|
|
237
237
|
|
|
238
|
-
if (!req.destroyed || req.errored) {
|
|
239
|
-
req.on('error', noop)
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (!res.destroyed || res.errored) {
|
|
243
|
-
res.on('error', noop)
|
|
244
|
-
}
|
|
245
|
-
|
|
246
238
|
if (thenable?.then) {
|
|
247
239
|
await thenable
|
|
248
240
|
}
|
|
@@ -269,6 +261,18 @@ export async function requestMiddleware(ctx, next) {
|
|
|
269
261
|
} catch (err) {
|
|
270
262
|
ctx[kAbortController]?.abort(err)
|
|
271
263
|
|
|
264
|
+
if (!req.closed) {
|
|
265
|
+
req.on('error', (err) => {
|
|
266
|
+
reqLogger?.warn({ err }, 'request error')
|
|
267
|
+
})
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (!res.closed) {
|
|
271
|
+
res.on('error', (err) => {
|
|
272
|
+
reqLogger?.warn({ err }, 'response error')
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
|
|
272
276
|
const statusCode = err.statusCode || err.$metadata?.httpStatusCode || 500
|
|
273
277
|
const elapsedTime = performance.now() - startTime
|
|
274
278
|
|