Skip to content

Commit

Permalink
Fetch: tests for safelisting simple range headers from preflight
Browse files Browse the repository at this point in the history
For whatwg/fetch#1312.

Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
  • Loading branch information
2 people authored and Gabisampaio committed Nov 18, 2021
1 parent 0bbef3c commit f0abbbf
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion cors/cors-safelisted-request-header.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,24 @@ function safelist(headers, expectPreflight = false) {
["multipart/form-data;\"", true]
].forEach(([mimeType, preflight = false]) => {
safelist({"content-type": mimeType}, preflight);
})
});

[
["100-200", true],
["MB=100-200", true],
["bytes=100-200"],
["bytes=100-200hello", true],
["bytes=abc-def", true],
["bytes=100-200,300-400", true],
["bytes=-200", true],
["bytes=200-"],
["bytes=200-100", true],
[`bytes=1${'0'.repeat(60)}-2${'0'.repeat(60)}`, true],
["bytes 100-200", true],
["bytes = 100-200", true],
["bytes =100-200", true],
[",bytes=100-200", true],
["bytes=,100-200", true],
].forEach(([value, preflight = false]) => {
safelist({"range": value}, preflight);
});

0 comments on commit f0abbbf

Please sign in to comment.