summaryrefslogtreecommitdiffstats
path: root/dom/cache/test/mochitest/test_cache_redirect.js
blob: 7d62970b7bbb81a79392ba9bdb79a76669e94587 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* global context testDone:true */

let cache;
let url = "foo.html";
let redirectURL = "https://example.com/foo-bar.html";
caches
  .open("redirect-" + context)
  .then(c => {
    cache = c;
    var response = Response.redirect(redirectURL);
    is(response.headers.get("Location"), redirectURL);
    return cache.put(url, response);
  })
  .then(_ => {
    return cache.match(url);
  })
  .then(response => {
    is(response.headers.get("Location"), redirectURL);
    testDone();
  });