From 9d8b033714323261402101475298772b05e41244 Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Tue, 12 Jan 2021 09:58:23 +0100 Subject: [PATCH] fix: setup default timeout when is necessary --- src/index.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/index.js b/src/index.js index 87b1811..a53a159 100644 --- a/src/index.js +++ b/src/index.js @@ -64,7 +64,7 @@ const fetch = ( const prerender = async ( url, - { getBrowserless, toEncode, headers, gotOpts, ...opts } + { getBrowserless, toEncode, headers, gotOpts, timeout = REQ_TIMEOUT, ...opts } ) => { let fetchRes let data = {} @@ -86,11 +86,7 @@ const prerender = async ( } }) - const payload = await getPayload(url, { - ...opts, - headers, - timeout: REQ_TIMEOUT - }) + const payload = await getPayload(url, { ...opts, headers, timeout }) await fetchRes.cancel() debug('prerender', { url, state: 'success' })