Skip to content

Commit

Permalink
Merge pull request #5 from techinasia/dev
Browse files Browse the repository at this point in the history
Delete Cookies
  • Loading branch information
lesterchan authored Sep 10, 2018
2 parents 68a528a + 0231ac9 commit 49f8489
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,14 @@ const fetchContent = async (pageURL) => {
// Get page content
let content = await pTimeout(page.content(), config.render.timeout * 1000, 'Render timed out');

// Close page
page.close();
// Delete cookies
page.cookies().then((cookies) => {
const cookieNames = cookies.map((cookie) => ({ name: cookie.name }));
return page.deleteCookie(...cookieNames).then(() => {
// Close page
page.close();
});
});

// Remove comments
content = content.replace(/<!--[\s\S]*?-->/g, '');
Expand Down

0 comments on commit 49f8489

Please sign in to comment.