@nxtedition/lib 12.1.13 → 12.1.14

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.
Files changed (2) hide show
  1. package/http.js +7 -3
  2. package/package.json +1 -1
package/http.js CHANGED
@@ -120,7 +120,7 @@ module.exports.request = async function request(ctx, next) {
120
120
  reqLogger.warn({ err }, 'request error')
121
121
  })
122
122
 
123
- if (!res.headersSent) {
123
+ if (!res.headersSent && !res.destroyed) {
124
124
  let reqId = req?.id || err.id
125
125
  for (const name of res.getHeaderNames()) {
126
126
  if (!reqId && name === 'request-id') {
@@ -164,9 +164,13 @@ module.exports.request = async function request(ctx, next) {
164
164
  }
165
165
  } finally {
166
166
  queueMicrotask(() => {
167
+ if (!req.destroyed) {
168
+ req.on('error', noop).destroy()
169
+ }
170
+ if (!res.destroyed) {
171
+ res.on('error', noop).destroy()
172
+ }
167
173
  ac.abort()
168
- req.on('error', noop).destroy()
169
- res.on('error', noop).destroy()
170
174
  })
171
175
  }
172
176
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "12.1.13",
3
+ "version": "12.1.14",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "files": [