Skip to content

Commit

Permalink
Fetch: test Headers iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Sep 5, 2017
1 parent b27b3a5 commit 6058e5f
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion fetch/api/headers/headers-combine.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>Headers nameshake</title>
<title>Headers have combined (and sorted) values</title>
<meta name="help" href="https://fetch.spec.whatwg.org/#headers">
<meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
<script src="/resources/testharness.js"></script>
Expand Down Expand Up @@ -53,6 +53,24 @@
assert_equals(headers.get(name), (value + ", " + "newSingleValue"));
}
}, "Check append methods when called with already used name");

test(() => {
const headers = new Headers([["1", "a"],["1", "b"]]);
for(let header of headers) {
assert_array_equals(header, ["1", "a, b"]);
}
}, "Iterate combined values");

test(() => {
const headers = new Headers([["2", "a"], ["1", "b"], ["2", "b"]]),
expected = [["1", "b"], ["2", "a, b"]];
let i = 0;
for(let header of headers) {
assert_array_equals(header, expected[i]);
i++;
}
assert_equals(i, 2);
}, "Iterate combined values in sorted order")
</script>
</body>
</html>

0 comments on commit 6058e5f

Please sign in to comment.