Bug 1319846 P3 Add a wpt test verifying Cache API can store and reproduce Response.redirect(). r=asuth

This commit is contained in:
Ben Kelly 2016-11-28 14:18:27 -08:00
parent 3806e267dc
commit 8eea6736f4

View File

@ -284,4 +284,22 @@ cache_test(function(cache) {
'TypeError.');
}, 'Cache.put with an embedded VARY:* Response');
cache_test(function(cache) {
var url = 'foo.html';
var redirectURL = 'http://example.com/foo-bar.html';
var redirectResponse = Response.redirect(redirectURL);
assert_equals(redirectResponse.headers.get('Location'), redirectURL,
'Response.redirect() should set Location header.');
return cache.put(url, redirectResponse.clone())
.then(function() {
return cache.match(url);
})
.then(function(response) {
assert_response_equals(response, redirectResponse,
'Redirect response is reproduced by the Cache API');
assert_equals(response.headers.get('Location'), redirectURL,
'Location header is preserved by Cache API.');
});
}, 'Cache.put should store Response.redirect() correctly');
done();