@johntalton/http-util 4.1.0 → 4.1.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/package.json +1 -1
  2. package/src/body.js +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johntalton/http-util",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
package/src/body.js CHANGED
@@ -94,7 +94,8 @@ export function requestBody(stream, options) {
94
94
 
95
95
 
96
96
  const listener = () => {
97
- controller.error(new Error('Abort Signal Timed out'))
97
+ stats.closed = true
98
+ controller.error(new Error('Abort Signal'))
98
99
  }
99
100
 
100
101
  signal?.addEventListener('abort', listener, { once: true })
@@ -146,6 +147,8 @@ export function requestBody(stream, options) {
146
147
 
147
148
  stream.on('close', () => {
148
149
  // console.log('body reader stream close')
150
+ signal?.removeEventListener('abort', listener)
151
+
149
152
  if(!stats.closed) {
150
153
  stats.closed = true
151
154
  controller.close()