question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to intercept response for file upload via filechooser/

See original GitHub issue

Website uploads file immediately on file change. I want to intercept JSON response of this upload. Is it possible?

page.on("filechooser", (fileChooser: FileChooser) => {
	fileChooser.setFiles(["/Volumes/Data/Dropbox/Public/111.jpg"]);
});
await page.click('input[name="up[]"]');

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
indapubliccommented, Dec 8, 2021

Ok, solved with

this._page.on("response", async (response) => {
	if ("url what i needed" === response.url()) {
		console.log(await response.json());
	}
});
0reactions
indapubliccommented, Dec 8, 2021

One question related to this subject, so I will ask in closed thread.

From here

const response = await page.request.fetch(route.request());

How it should be modified for multipart data? Or probably I can get json of complete response already?

Because const response = await page.request.post(route.request()); causing error on website (it’s 3rd party website so I can’t say what a reason here)

Read more comments on GitHub >

github_iconTop Results From Across the Web

FileChooser accept for file upload not working when ... - GitHub
Either the request interception is stuck or the fileChooser is not able to send the Asynchrounous Response with the right set of intercepted...
Read more >
How to Use File Choosers - Oracle Help Center
//Create a file chooser final JFileChooser fc = new JFileChooser(); ... //In response to a button click: int returnVal = fc.showOpenDialog(aComponent);. The ...
Read more >
File Upload in WebView - android - Stack Overflow
I have an HTML page with the following code to upload a file. <form method="POST" enctype="multipart/form-data"> ...
Read more >
File Upload Interceptor - Apache Struts
Interceptor that is based off of MultiPartRequestWrapper , which is automatically applied for any request that includes a file. It adds the following...
Read more >
Upload Vulnerabilities TryHackme Writeup | by Shamsher khan
Tutorial room exploring some basic file-upload vulnerabilities in… ... request to the website and intercepting the response with Burpsuite.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found