chore(bidi): add support for fetching request bodies
I have also updated the tests to use request.body* instead of request.postData* except for the following:
- I changed the tests in
tests/page/network-post-data.spec.tsto be skipped for BiDi because these tests are mirrored by those intests/page/network-request-body.spec.ts - I didn't change
tests/page/page-request-fallback.spec.tsbecause it only tests overridden request bodies which are always available synchronously
Fixes the following tests in Firefox:
-
tests/page/network-request-body.spec.ts:- "should return correct request body buffer for utf-8 body"
- "should return request body w/o content-type"
- "should throw on invalid JSON in post data"
- "should return body for PUT requests"
- "should get request body for file/blob"
- "should get request body for navigator.sendBeacon api calls"
-
tests/page/page-network-request.spec.ts:- "should parse the data if content-type is application/x-www-form-urlencoded"
- "should parse the data if content-type is application/x-www-form-urlencoded; charset=UTF-8"
- "should parse the json post data"
- "should return multipart/form-data"
- "should return postData"
- "should work with binary post data"
- "should work with binary post data and interception"
-
tests/page/page-request-intercept.spec.ts:- "request.postData is not null when fetching FormData with a Blob"
- "should intercept multipart/form-data request body"
-
tests/page/page-route.spec.ts:- "should intercept when postData is more than 1MB"
Test results for "tests 1"
13 failed
:x: [playwright-test] › playwright.trace.spec.ts:1217 › should not nest top level expect into unfinished api calls @macos-latest-node18-1
:x: [playwright-test] › runner.spec.ts:118 › should ignore subprocess creation error because of SIGINT @macos-latest-node18-2
:x: [playwright-test] › test-step.spec.ts:1502 › calls from page.route callback should be under its parent step @macos-latest-node18-2
:x: [playwright-test] › playwright.trace.spec.ts:1217 › should not nest top level expect into unfinished api calls @ubuntu-latest-node18-1
:x: [playwright-test] › test-step.spec.ts:1502 › calls from page.route callback should be under its parent step @ubuntu-latest-node18-2
:x: [playwright-test] › playwright.trace.spec.ts:1217 › should not nest top level expect into unfinished api calls @ubuntu-latest-node20-1
:x: [playwright-test] › test-step.spec.ts:1502 › calls from page.route callback should be under its parent step @ubuntu-latest-node20-2
:x: [playwright-test] › playwright.trace.spec.ts:1217 › should not nest top level expect into unfinished api calls @ubuntu-latest-node22-1
:x: [playwright-test] › test-step.spec.ts:1502 › calls from page.route callback should be under its parent step @ubuntu-latest-node22-2
:x: [playwright-test] › playwright.trace.spec.ts:1217 › should not nest top level expect into unfinished api calls @ubuntu-latest-node24-1
:x: [playwright-test] › test-step.spec.ts:1502 › calls from page.route callback should be under its parent step @ubuntu-latest-node24-2
:x: [playwright-test] › playwright.trace.spec.ts:1217 › should not nest top level expect into unfinished api calls @windows-latest-node18-1
:x: [playwright-test] › test-step.spec.ts:1502 › calls from page.route callback should be under its parent step @windows-latest-node18-2
3 flaky
:warning: [chromium-library] › library/popup.spec.ts:258 › should not throw when click closes popup `@chromium-ubuntu-22.04-node20`:warning: [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1079 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node18`
:warning: [firefox-page] › page/page-wait-for-function.spec.ts:104 › should work with strict CSP policy `@firefox-ubuntu-22.04-node18`
40258 passed, 787 skipped
Merge workflow run.
Test results for "MCP"
2 flaky
:warning: [chrome] › mcp/cdp.spec.ts:24 › cdp server `@mcp-windows-latest`:warning: [chrome] › mcp/cdp.spec.ts:35 › cdp server reuse tab `@mcp-windows-latest`
2430 passed, 116 skipped
Merge workflow run.
Test results for "tests 1"
1 failed
:x: [playwright-test] › runner.spec.ts:118 › should ignore subprocess creation error because of SIGINT @macos-latest-node18-2
4 flaky
:warning: [chromium-library] › library/headful.spec.ts:233 › should click in OOPIF `@chromium-ubuntu-22.04-node18`:warning: [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1079 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node18`
:warning: [playwright-test] › ui-mode-test-progress.spec.ts:165 › should update tracing network live `@macos-latest-node18-2`
:warning: [playwright-test] › ui-mode-trace.spec.ts:659 › should indicate current test status `@macos-latest-node18-2`
40269 passed, 787 skipped
Merge workflow run.
Test results for "MCP"
2 flaky
:warning: [chrome] › mcp/cdp.spec.ts:24 › cdp server `@mcp-windows-latest`:warning: [chrome] › mcp/cdp.spec.ts:35 › cdp server reuse tab `@mcp-windows-latest`
2430 passed, 116 skipped
Merge workflow run.
Test results for "tests 1"
1 failed
:x: [playwright-test] › runner.spec.ts:118 › should ignore subprocess creation error because of SIGINT @macos-latest-node18-2
2 flaky
:warning: [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1079 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node18`:warning: [firefox-page] › page/page-wait-for-function.spec.ts:104 › should work with strict CSP policy `@firefox-ubuntu-22.04-node18`
40312 passed, 787 skipped
Merge workflow run.
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.