@whatwg-node/node-fetch
Advanced tools
Comparing version 0.7.6-alpha-20250107152855-99117d0a5f26dc2dd6bea8c040e061116acf8a92 to 0.7.6-alpha-20250107153245-67dca693f97cb0bf5b4799924f9dde8537394b60
@@ -66,15 +66,14 @@ "use strict"; | ||
let streamResolved; | ||
function onAbort() { | ||
if (curlHandle.isOpen) { | ||
try { | ||
curlHandle.pause(CurlPause.Recv); | ||
if (fetchRequest['_signal']) { | ||
fetchRequest['_signal'].onabort = () => { | ||
if (curlHandle.isOpen) { | ||
try { | ||
curlHandle.pause(CurlPause.Recv); | ||
} | ||
catch (e) { | ||
deferredPromise.reject(e); | ||
} | ||
} | ||
catch (e) { | ||
deferredPromise.reject(e); | ||
} | ||
} | ||
}; | ||
} | ||
if (fetchRequest['_signal']) { | ||
fetchRequest['_signal'].addEventListener('abort', onAbort, { once: true }); | ||
} | ||
curlHandle.once('end', function endListener() { | ||
@@ -87,5 +86,2 @@ try { | ||
} | ||
if (fetchRequest['_signal']) { | ||
fetchRequest['_signal'].removeEventListener('abort', onAbort); | ||
} | ||
}); | ||
@@ -92,0 +88,0 @@ curlHandle.once('error', function errorListener(error) { |
@@ -63,15 +63,14 @@ import { PassThrough, Readable } from 'node:stream'; | ||
let streamResolved; | ||
function onAbort() { | ||
if (curlHandle.isOpen) { | ||
try { | ||
curlHandle.pause(CurlPause.Recv); | ||
if (fetchRequest['_signal']) { | ||
fetchRequest['_signal'].onabort = () => { | ||
if (curlHandle.isOpen) { | ||
try { | ||
curlHandle.pause(CurlPause.Recv); | ||
} | ||
catch (e) { | ||
deferredPromise.reject(e); | ||
} | ||
} | ||
catch (e) { | ||
deferredPromise.reject(e); | ||
} | ||
} | ||
}; | ||
} | ||
if (fetchRequest['_signal']) { | ||
fetchRequest['_signal'].addEventListener('abort', onAbort, { once: true }); | ||
} | ||
curlHandle.once('end', function endListener() { | ||
@@ -84,5 +83,2 @@ try { | ||
} | ||
if (fetchRequest['_signal']) { | ||
fetchRequest['_signal'].removeEventListener('abort', onAbort); | ||
} | ||
}); | ||
@@ -89,0 +85,0 @@ curlHandle.once('error', function errorListener(error) { |
{ | ||
"name": "@whatwg-node/node-fetch", | ||
"version": "0.7.6-alpha-20250107152855-99117d0a5f26dc2dd6bea8c040e061116acf8a92", | ||
"version": "0.7.6-alpha-20250107153245-67dca693f97cb0bf5b4799924f9dde8537394b60", | ||
"description": "Fetch API implementation for Node", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
222516
5635