diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2020-06-03 15:43:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 09:43:11 -0400 |
commit | a1915a0d4fd7d760c234e209967d842f851628d5 (patch) | |
tree | 951302fc16b36b9cc459049919d4681cc1907d18 /cli/tests/unit/fetch_test.ts | |
parent | aaa2ed5a6450572d90fdb3fc2f0000759599d46f (diff) |
fix(fetch): Support 101 status code (#6059)
Diffstat (limited to 'cli/tests/unit/fetch_test.ts')
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index b95ecfb96..7c054c964 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -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]` + ); + } + } + } +); |