I want to console.log()
the request
and response
made with WebSocket.
const browser = await puppeteer.launch({
headless: false,
args: [
'--incognito',
'--enable-features=NetworkService'
]
});
...
await page.on('console', msg => {
console.log(msg);
}
});
...
await page.setRequestInterception(true);
page.on('request', request => {
console.log('Intercepting Request ', request, { depth: null });
request.continue();
});
page.on('response', response => {
console.log('Intercepting Response ', response, { depth: null });
});
It does not log the request
, although one is made. It doesn't log the response
neither. However, when I add
page.on('response', response => {
console.log('Intercepting Response ', response, { depth: null });
response.continue();
});
to it, it logs the response
. But then I get
(node:15634) UnhandledPromiseRejectionWarning: TypeError: response.continue is not a function
What is happening here?