diff --git a/lib/Synchronizer.js b/lib/Synchronizer.js index b380dc3..10a8a67 100644 --- a/lib/Synchronizer.js +++ b/lib/Synchronizer.js @@ -38,6 +38,9 @@ function verify(publicKey, body, ts, nonce, signature) { return verify2.verify(publicKey, signature, 'hex'); } async function fetchWithTimeout(url, options, timeout = 5000) { + if (typeof AbortController === 'undefined' || timeout === 0) { + return fetch(url, options); + } const controller = new AbortController(); const signal = controller.signal; // 设置超时 diff --git a/src/Synchronizer.ts b/src/Synchronizer.ts index 67f883c..7be23f7 100644 --- a/src/Synchronizer.ts +++ b/src/Synchronizer.ts @@ -63,6 +63,9 @@ function verify(publicKey: string, body: string, ts: string, nonce: string, sign } async function fetchWithTimeout(url: string, options: RequestInit, timeout = 5000) { + if (typeof AbortController === 'undefined' || timeout === 0) { + return fetch(url, options); + } const controller = new AbortController(); const signal = controller.signal;