diff --git a/dist/fetch-retry.umd.js b/dist/fetch-retry.umd.js index 948dde6..a06e973 100644 --- a/dist/fetch-retry.umd.js +++ b/dist/fetch-retry.umd.js @@ -68,10 +68,15 @@ var wrappedFetch = function (attempt) { // As of node 18, this is no longer needed since node comes with native support for fetch: /* istanbul ignore next */ - var _input = + try { + var _input = typeof Request !== 'undefined' && input instanceof Request ? input.clone() : input; + } catch (error) { + return reject(error); + } + fetch(_input, init) .then(function (response) { if (Array.isArray(retryOn) && retryOn.indexOf(response.status) === -1) { diff --git a/index.js b/index.js index 1a9dc43..820b9af 100644 --- a/index.js +++ b/index.js @@ -64,10 +64,15 @@ module.exports = function (fetch, defaults) { var wrappedFetch = function (attempt) { // As of node 18, this is no longer needed since node comes with native support for fetch: /* istanbul ignore next */ - var _input = + try { + var _input = typeof Request !== 'undefined' && input instanceof Request ? input.clone() : input; + } catch (error) { + return reject(error); + } + fetch(_input, init) .then(function (response) { if (Array.isArray(retryOn) && retryOn.indexOf(response.status) === -1) {