summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fetch/api/redirect/redirect-empty-location.any.js
blob: 487f4d42e9239f1319bff6a8cbc46bb11231be60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// META: global=window,worker
// META: script=../resources/utils.js

// Tests receiving a redirect response with a Location header with an empty
// value.

const url = RESOURCES_DIR + 'redirect-empty-location.py';

promise_test(t => {
  return promise_rejects_js(t, TypeError, fetch(url, {redirect:'follow'}));
}, 'redirect response with empty Location, follow mode');

promise_test(t => {
  return fetch(url, {redirect:'manual'})
    .then(resp => {
      assert_equals(resp.type, 'opaqueredirect');
      assert_equals(resp.status, 0);
    });
}, 'redirect response with empty Location, manual mode');

done();