@nxtedition/http 1.0.0 → 1.0.1

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/lib/index.js +8 -4
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -220,10 +220,10 @@ export async function upgradeMiddleware(
220
220
  reqLogger?.debug({ req }, 'request started')
221
221
  }
222
222
 
223
- const thenable = next()
223
+ const thenable = next()
224
224
 
225
- if (Object.hasOwnProperty.call(thenable, 'then')) {
226
- await thenable
225
+ if (thenable?.then) {
226
+ await (thenable )
227
227
  }
228
228
 
229
229
  if (!socket.destroyed && !socket.writableEnded) {
@@ -323,7 +323,11 @@ export async function requestMiddleware(
323
323
  r._read()
324
324
  }
325
325
 
326
- await next()
326
+ const thenable = next()
327
+
328
+ if (thenable?.then) {
329
+ await (thenable )
330
+ }
327
331
 
328
332
  if (!res.destroyed && !res.writableEnded) {
329
333
  throw new Error('Response not completed')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/http",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -32,5 +32,5 @@
32
32
  "rimraf": "^6.1.2",
33
33
  "typescript": "^5.9.3"
34
34
  },
35
- "gitHead": "64c1bd97cf9a785ca4a750b5380418878cbed2d2"
35
+ "gitHead": "9cff555aa7e0481dccf43c3c030ecfcab8595235"
36
36
  }