mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 13:44:08 +00:00
fix(fetch): Support 101 status code (#6059)
This commit is contained in:
parent
aaa2ed5a64
commit
a1915a0d4f
2 changed files with 25 additions and 4 deletions
|
@ -767,7 +767,7 @@ unitTest(
|
|||
unitTest(
|
||||
{ perms: { net: true } },
|
||||
async function fetchNullBodyStatus(): Promise<void> {
|
||||
const nullBodyStatus = [204, 205, 304];
|
||||
const nullBodyStatus = [101, 204, 205, 304];
|
||||
|
||||
for (const status of nullBodyStatus) {
|
||||
const headers = new Headers([["x-status", String(status)]]);
|
||||
|
@ -801,3 +801,23 @@ unitTest(
|
|||
}
|
||||
}
|
||||
);
|
||||
|
||||
unitTest(
|
||||
{ perms: { net: true } },
|
||||
function fetchResponseConstructorInvalidStatus(): void {
|
||||
const invalidStatus = [101, 600, 199];
|
||||
|
||||
for (const status of invalidStatus) {
|
||||
try {
|
||||
new Response("deno", { status });
|
||||
fail("Invalid status");
|
||||
} catch (e) {
|
||||
assert(e instanceof RangeError);
|
||||
assertEquals(
|
||||
e.message,
|
||||
`The status provided (${status}) is outside the range [200, 599]`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue