Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

158
Visualizações
Intercepting requests in Puppeteer - updated postData not being sent

So after solving yesterday's problem (linked below) another one has popped up.

Setting a FormData key/value on click with Puppeteer/NodeJS

The issue I'm having today is that I'm trying to modify an existing key in the FormData that's being sent to the server. The request gets intercepted correctly, I parse the FormData using the "qs" query string parsing package, then try to modify an existing key and use "NEW VALUE" in it's place. When I log it everything looks fine. However when I run chrome with headless=false and inspect the traffic I can see that the request is being sent without "NEW VALUE". It's as if I'm just calling continue() without passing any parameters in. I've attached the code below.

await this.page.setRequestInterception(true);
this.page.on("request", interceptedRequest => {
    const formDataObj = qs.parse(interceptedRequest.postData());
    if (interceptedRequest.url() === "https://www.someurl.com" && formDataObj.email) {
        formDataObj.existingKey= "NEW VALUE";
        const options = {
            'method': 'POST',
            'postData': qs.stringify(formDataObj),
            'headers': {
                ...interceptedRequest.headers(),
                'Content-Type': 'application/x-www-form-urlencoded'
            },
        };
        console.log("Sending with new data");
        console.log(qs.stringify(formDataObj));
        interceptedRequest.continue(options);
    } else {
        interceptedRequest.continue();
    }

Not sure where to go from here. I've done a lot of reading and tried some things like different versions of Puppeteer, passing ONLY the FormData (as a string) in to the continue() call and using some flags like "--enable-feature=NetworkService" (suggested on github) when launching chrome but nothing is working. Any help would be greatly appreciated!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda