Unable to get multipart/form-data from POST requests with requestInterceptor
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 2.0.0
- Platform / OS version: macOS 10.15 (19A602)
- URLs (if applicable): https://codesandbox.io/s/fervent-http-c24v7 (for the demo)
- Node.js version: v12.13.0
What steps will reproduce the problem?
Please include code that reproduces the issue.
- Create a form with
enctype="multipart/form-data"
, e.g. https://codesandbox.io/s/fervent-http-c24v7 - Open the page with puppeteer, add a request interceptor, add a file to the upload input and submit the form.
const puppeteer = require("puppeteer");
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setRequestInterception(true);
page.on("request", (interceptedRequest) => {
if (interceptedRequest.method() === "POST") {
console.log(interceptedRequest.postData());
}
interceptedRequest.continue();
});
await page.goto("https://c24v7.codesandbox.io/");
const input = await page.$("#file_input");
// a simple txt file with little just some dummy text
await input.uploadFile("./file.txt");
await page.click("#submit");
await browser.close();
})().catch(console.error);
What is the expected result? According to me, the multipart/form-data should be available inside the request interceptor (requestInterceptor.postData()).
What happens instead? The requestInterceptor.postData() is undefined. Interestingly, when using puppeteer-firefox, this very same code works properly and the postData() is available inside the requestInterceptor.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Cannot send form data with axios when using interceptors
My 3rd try was to add a request interceptor by modifying config (add formData ) before request is sent but I never access...
Read more >Axios - npm
Using multipart/form-data format. FormData; Automatic serialization. Files Posting; HTML Form Posting; Progress capturing ...
Read more >How can I make a multipart/form-data POST request in VQL
How can I make a multipart/form-data POST request in VQL. VQL can be used to make http requests using the http_client() plugin. While...
Read more >Fuel HTTP Library with Kotlin - Baeldung
Support for basic HTTP verbs (GET, POST, DELETE, etc.) both asynchronous and blocking requests; Ability to download and upload a file (multipart ......
Read more >dio | Dart Package - Pub.dev
A powerful Http client for Dart, which supports Interceptors, FormData, Request ... it may be `null` if the request can't reach to ///...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve switched to Firefox @rgoldstein01
We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!