Skip to content

Commit 92051fc

Browse files
committed
Pass response to evaluate method
1 parent 262f36c commit 92051fc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ module.exports = launchOpts => {
6565

6666
if (userAgent) await page.setUserAgent(userAgent)
6767
if (viewport) await page.setViewport(viewport)
68-
await page.goto(url, Object.assign({ waitUntil }, args))
68+
const response = await page.goto(url, Object.assign({ waitUntil }, args))
6969
if (waitFor) await page.waitFor(waitFor)
7070
debug(reqCount)
71+
return response
7172
}
7273

7374
const evaluate = fn => async (url, opts = {}) => {
@@ -82,7 +83,7 @@ module.exports = launchOpts => {
8283
} = opts
8384

8485
const page = await newPage()
85-
await goto(page, {
86+
const response = await goto(page, {
8687
url,
8788
abortTrackers,
8889
abortTypes,
@@ -92,8 +93,8 @@ module.exports = launchOpts => {
9293
viewport,
9394
args
9495
})
95-
const content = await fn(page)
9696

97+
const content = await fn(page, response)
9798
await page.close()
9899
return content
99100
}

0 commit comments

Comments
 (0)