summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fetch/api/request/request-keepalive.any.js
blob: cb4506db46c931ca347b05a7caa108292e480fc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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');