@nxtedition/lib 25.1.4 → 25.1.6

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 +5 -12
  2. package/package.json +1 -1
package/http.js CHANGED
@@ -154,13 +154,8 @@ export async function upgradeMiddleware(ctx, next) {
154
154
  }
155
155
  })
156
156
 
157
- const isHealthcheck = req.url === '/healthcheck' || req.url === '/_up'
158
-
159
157
  try {
160
- if (req.method === 'GET' || req.method === 'HEAD' || req.method === 'OPTIONS') {
161
- req.resume() // Dump the body if there is one.
162
- }
163
-
158
+ const isHealthcheck = req.url === '/healthcheck' || req.url === '/_up'
164
159
  if (!isHealthcheck) {
165
160
  ctx.logger?.debug({ req }, 'stream started')
166
161
  }
@@ -215,12 +210,7 @@ export async function requestMiddleware(ctx, next) {
215
210
  const startTime = performance.now()
216
211
 
217
212
  try {
218
- if (req.method === 'GET' || req.method === 'HEAD' || req.method === 'OPTIONS') {
219
- req.resume() // Dump the body if there is one.
220
- }
221
-
222
213
  const isHealthcheck = req.url === '/healthcheck' || req.url === '/_up'
223
-
224
214
  if (!isHealthcheck) {
225
215
  ctx.logger?.debug({ req }, 'request started')
226
216
  }
@@ -231,9 +221,12 @@ export async function requestMiddleware(ctx, next) {
231
221
 
232
222
  const thenable = next()
233
223
 
234
- if (thenable?.then) {
224
+ if (thenable?.then || res.errored || req.errored) {
235
225
  req.on('error', noop)
236
226
  res.on('error', noop)
227
+ }
228
+
229
+ if (thenable?.then) {
237
230
  await thenable
238
231
  }
239
232
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "25.1.4",
3
+ "version": "25.1.6",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",