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-keepalive.any.html - WPT Dashboard Interop Dashboard
- /fetch/api/request/request-keepalive.any.serviceworker.html - WPT Dashboard Interop Dashboard
- /fetch/api/request/request-keepalive.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /fetch/api/request/request-keepalive.any.worker.html - WPT Dashboard Interop Dashboard
// META: global=window,worker
// META: title=Request keepalive
// META: script=/common/utils.js
// META: script=/common/get-host-info.sub.js
test(() => {
assert_false(new Request('/').keepalive, 'default');
assert_true(new Request('/', {keepalive: true}).keepalive, 'true');
assert_false(new Request('/', {keepalive: false}).keepalive, 'false');
assert_true(new Request('/', {keepalive: 1}).keepalive, 'truish');
assert_false(new Request('/', {keepalive: 0}).keepalive, 'falsy');
}, 'keepalive flag');
test(() => {
const init = {method: 'POST', keepalive: true, body: new ReadableStream()};
assert_throws_js(TypeError, () => {new Request('/', init)});
}, 'keepalive flag with stream body');