MCPcopy
hub / github.com/vercel/next.js / beforePageLoad

Function beforePageLoad

test/e2e/app-dir/next-image/next-image-proxy.test.ts:60–76  ·  view source on GitHub ↗
(page)

Source from the content-addressed store, hash-verified

58 const browser = await webdriver(`https://localhost:${proxyPort}`, '/', {
59 ignoreHTTPSErrors: true,
60 beforePageLoad(page) {
61 page.on('response', (response) => {
62 const url = response.url()
63 if (!url.includes('/_next/image')) return
64
65 const status = response.status()
66
67 console.log(`URL: ${url} Status: ${status}`)
68
69 if (!response.ok()) {
70 console.log(`Request failed: ${url}`)
71 failCount++
72 }
73
74 fulfilledCount++
75 })
76 },
77 })
78
79 const local = await browser.elementByCss('#app-page').getAttribute('src')

Callers

nothing calls this directly

Calls 6

includesMethod · 0.80
urlMethod · 0.65
okMethod · 0.65
onMethod · 0.45
statusMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected