Skip to content

Commit

Permalink
Merge pull request #38 from Kikobeats/cancelable
Browse files Browse the repository at this point in the history
fix: don't throw an error on cancel
  • Loading branch information
Kikobeats authored Mar 26, 2019
2 parents 682d5ba + 98cddef commit 6fd9ed7
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const fetch = (url, { toEncode, reflect = false, ...opts }) =>
...opts
})

onCancel.shouldReject = false
onCancel(() => req.cancel && req.cancel())

try {
Expand All @@ -73,10 +74,7 @@ const fetch = (url, { toEncode, reflect = false, ...opts }) =>
}
})

const prerender = async (
url,
{ getBrowserless, gotOptions, toEncode, ...opts }
) => {
const prerender = async (url, { getBrowserless, gotOptions, toEncode, ...opts }) => {
let fetchReq
let fetchDataProps = {}
let isFetchRejected = false
Expand Down Expand Up @@ -125,16 +123,8 @@ const baseHtml = ({ url, headers, head, body }) => {
<meta name="viewport" content="width=device-width, initial-scale=1.0" shrink-to-fit="no">
<title>${path.basename(url)}</title>
<meta property="og:site_name" content="${hostname}">
${
date
? `<meta property="article:published_time" content="${date}">`
: ''
}
${
expires
? `<meta property="article:expiration_time" content="${expires}">`
: ''
}
${date ? `<meta property="article:published_time" content="${date}">` : ''}
${expires ? `<meta property="article:expiration_time" content="${expires}">` : ''}
<meta property="og:locale" content="en">
<meta property="og:url" content="${url}">
${head}
Expand Down

0 comments on commit 6fd9ed7

Please sign in to comment.