@arianee/utils
Advanced tools
Comparing version 1.11.0 to 1.11.1
{ | ||
"name": "@arianee/utils", | ||
"version": "1.11.0", | ||
"version": "1.11.1", | ||
"type": "commonjs", | ||
@@ -9,3 +9,3 @@ "dependencies": { | ||
"peerDependencies": { | ||
"@arianee/common-types": "1.11.0", | ||
"@arianee/common-types": "1.11.1", | ||
"tslib": "2.5.0" | ||
@@ -12,0 +12,0 @@ }, |
@@ -24,4 +24,5 @@ "use strict"; | ||
const timeout = (_a = init === null || init === void 0 ? void 0 : init.timeout) !== null && _a !== void 0 ? _a : 30000; | ||
let timeoutInstance; | ||
const timeoutPromise = new Promise((_, reject) => { | ||
setTimeout(() => { | ||
timeoutInstance = setTimeout(() => { | ||
controller.abort(); | ||
@@ -32,3 +33,5 @@ reject(new Error(`Request to ${input} timed out after ${timeout}ms`)); | ||
init === null || init === void 0 ? true : delete init.timeout; | ||
const fetchPromise = _fetch(input, Object.assign(Object.assign({ signal: controller.signal }, init), { redirect: 'follow' })); | ||
const fetchPromise = _fetch(input, Object.assign(Object.assign({ signal: controller.signal }, init), { redirect: 'follow' })).finally(() => { | ||
clearTimeout(timeoutInstance); | ||
}); | ||
return Promise.race([fetchPromise, timeoutPromise]); | ||
@@ -35,0 +38,0 @@ }; |
Sorry, the diff of this file is not supported yet
21268
322