Skip to content

Commit

Permalink
fix: setup default timeout when is necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jan 12, 2021
1 parent f1e32c5 commit 9d8b033
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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' })
Expand Down

0 comments on commit 9d8b033

Please sign in to comment.