Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /fetch/api/request/request-constructor-init-body-override.any.html - WPT Dashboard Interop Dashboard
- /fetch/api/request/request-constructor-init-body-override.any.worker.html - WPT Dashboard Interop Dashboard
promise_test(async function () {
body: "req1",
method: "POST",
});
const text1 = await req1.text();
assert_equals(
text1,
"req1",
"The body of the first request should be 'req1'."
);
const req2 = new Request(req1, { body: "req2" });
const bodyText = await req2.text();
assert_equals(
bodyText,
"req2",
"The body of the second request should be overridden to 'req2'."
);
}, "Check that the body of a new request can be overridden when created from an existing Request object");
promise_test(async function () {
body: "req1",
method: "POST",
});
const bodyText = await req2.text();
assert_equals(
bodyText,
"req1",
"The body of the second request should be the same as the first."
);
}, "Check that the body of a new request can be duplicated from an existing Request object");