playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature]: add async `request.body()`

Open yury-s opened this issue 2 months ago • 3 comments

🚀 Feature Request

Fetching body is an async command in Bidi and it is a regret that in our current API request.postData is synchronous. Let's align with response and have async getter for the request body.

Example

No response

Motivation

Improve API.

yury-s avatar Nov 07 '25 21:11 yury-s

@hbenl heads-up, we are likely to release the new API in 1.57 and it can be employed in Bidi.

yury-s avatar Nov 12 '25 20:11 yury-s

Unfortunately the new API was reverted in https://github.com/microsoft/playwright/pull/38281 as we couldn't find a single use that it was fixing in Playwright today. I tried switching to Network.getRequestPostData in Chromium in hope that it would fix the problem for blob/file requests or multipart uploads, but unfortunately it doesn't. We can reconsider adding the async APIs if it fixes some of the scenarios, but looks like this needs to be fixed on Chromium/WebKit side first.

yury-s avatar Nov 21 '25 20:11 yury-s

@yury-s could you maybe shed some light on which fixes it needs for Chromium/WebKit? Are there an issue that we can block this issue on? Also do you think it is something that could be done soon? Thanks!

whimboo avatar Dec 01 '25 09:12 whimboo