gajus / puppeteer-proxy

Proxies Puppeteer Page requests.
Other
197 stars 24 forks source link

Puppeteer bug prevents this library from working with sites that use `request.clone()` #14

Open tristanreid opened 3 years ago

tristanreid commented 3 years ago

As documented here, Puppeteer has a bug where postData isn't available on cloned requests. I realize this is an upstream bug, but if it directly impacts ability to use this library, so I'm documenting it here.

This means that if a website uses popular libraries like KY to send POST requests, you will not be able to use puppeteer-proxy to reconstruct that call. Puppeteer will successfully execute the POST if the request is not intercepted, but it be undefined if intercepted and inspected.

await page.setRequestInterception(true)
page.on('request', async request => {
    // this will log  'undefined' for requests that were created with request.clone() on the page
    logger.info(request.postData())
    request.continue()
    })