@aws-sdk/xhr-http-handler
Advanced tools
Comparing version 3.713.0 to 3.714.0
@@ -179,6 +179,8 @@ "use strict"; | ||
]; | ||
let removeSignalEventListener = /* @__PURE__ */ __name(() => { | ||
}, "removeSignalEventListener"); | ||
if (abortSignal) { | ||
raceOfPromises.push( | ||
new Promise((resolve, reject) => { | ||
abortSignal.onabort = () => { | ||
const onAbort = /* @__PURE__ */ __name(() => { | ||
xhr.abort(); | ||
@@ -188,7 +190,14 @@ const abortError = new Error("Request aborted"); | ||
reject(abortError); | ||
}; | ||
}, "onAbort"); | ||
if (typeof abortSignal.addEventListener === "function") { | ||
const signal = abortSignal; | ||
signal.addEventListener("abort", onAbort, { once: true }); | ||
removeSignalEventListener = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "removeSignalEventListener"); | ||
} else { | ||
abortSignal.onabort = onAbort; | ||
} | ||
}) | ||
); | ||
} | ||
return Promise.race(raceOfPromises); | ||
return Promise.race(raceOfPromises).finally(removeSignalEventListener); | ||
} | ||
@@ -195,0 +204,0 @@ /** |
@@ -136,5 +136,6 @@ import { HttpResponse } from "@smithy/protocol-http"; | ||
]; | ||
let removeSignalEventListener = () => { }; | ||
if (abortSignal) { | ||
raceOfPromises.push(new Promise((resolve, reject) => { | ||
abortSignal.onabort = () => { | ||
const onAbort = () => { | ||
xhr.abort(); | ||
@@ -145,5 +146,13 @@ const abortError = new Error("Request aborted"); | ||
}; | ||
if (typeof abortSignal.addEventListener === "function") { | ||
const signal = abortSignal; | ||
signal.addEventListener("abort", onAbort, { once: true }); | ||
removeSignalEventListener = () => signal.removeEventListener("abort", onAbort); | ||
} | ||
else { | ||
abortSignal.onabort = onAbort; | ||
} | ||
})); | ||
} | ||
return Promise.race(raceOfPromises); | ||
return Promise.race(raceOfPromises).finally(removeSignalEventListener); | ||
} | ||
@@ -150,0 +159,0 @@ responseHeaders(xhrHeaders) { |
{ | ||
"name": "@aws-sdk/xhr-http-handler", | ||
"version": "3.713.0", | ||
"version": "3.714.0", | ||
"description": "Provides a way to make requests using XMLHttpRequest", | ||
@@ -23,3 +23,3 @@ "scripts": { | ||
"dependencies": { | ||
"@aws-sdk/types": "3.713.0", | ||
"@aws-sdk/types": "3.714.0", | ||
"@smithy/protocol-http": "^4.1.8", | ||
@@ -26,0 +26,0 @@ "@smithy/querystring-builder": "^3.0.11", |
39620
619
+ Added@aws-sdk/types@3.714.0(transitive)
- Removed@aws-sdk/types@3.713.0(transitive)
Updated@aws-sdk/types@3.714.0