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:
- /xhr/getallresponseheaders-after-reuse.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>XMLHttpRequest: getAllResponseHeaders() after reusing the object</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id="log"></div>
<script>
function load(client, url) {
return new Promise((resolve, reject) => {
client.onload = () => resolve(client.getAllResponseHeaders());
client.onerror = () => reject(new Error("unexpected error loading " + url));
client.open("GET", url);
client.send();
});
}
promise_test(async () => {
const client = new XMLHttpRequest();
assert_equals(await load(client, "resources/headers-basic.asis"),
"foo-test: 1, 2, 3\r\n", "first response");
assert_equals(await load(client, "resources/headers-www-authenticate.asis"),
"www-authenticate: 1, 2, 3, 4\r\n", "second response");
}, "getAllResponseHeaders() must not return the previous response's headers");
</script>