gajus/puppeteer-proxy

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

Open

#14 opened on Jul 28, 2020

View on GitHub
 (0 comments) (0 reactions) (0 assignees)JavaScript (27 forks)github user discovery
bughelp wanted

Repository metrics

Stars
 (214 stars)
PR merge metrics
 (PR metrics pending)

Description

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()
    })

Contributor guide