diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2022-03-16 09:30:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-16 14:30:43 +0100 |
commit | 45b3aa22c0adbea5fbfbd572eac172a60b79a5e9 (patch) | |
tree | 4648e7c7c3fab3945b9fe764fed1c697239481c5 | |
parent | 426ca98527185a68afb54c0cc943b61cfa851cd5 (diff) |
feat(ext/fetch): Allow Response status 101 (#13969)
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 8 | ||||
-rw-r--r-- | ext/fetch/23_response.js | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index 3b2d765a5..bfd5bc991 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -970,7 +970,7 @@ Deno.test(function fetchResponseConstructorNullBody() { }); Deno.test(function fetchResponseConstructorInvalidStatus() { - const invalidStatus = [101, 600, 199, null, "", NaN]; + const invalidStatus = [100, 600, 199, null, "", NaN]; for (const status of invalidStatus) { try { @@ -980,7 +980,11 @@ Deno.test(function fetchResponseConstructorInvalidStatus() { fail(`Invalid status: ${status}`); } catch (e) { assert(e instanceof RangeError); - assert(e.message.endsWith("is outside the range [200, 599].")); + assert( + e.message.endsWith( + "is not equal to 101 and outside the range [200, 599].", + ), + ); } } }); diff --git a/ext/fetch/23_response.js b/ext/fetch/23_response.js index 4dc56dd8f..03f8c276b 100644 --- a/ext/fetch/23_response.js +++ b/ext/fetch/23_response.js @@ -265,9 +265,9 @@ context: "Argument 2", }); - if (init.status < 200 || init.status > 599) { + if ((init.status < 200 || init.status > 599) && init.status != 101) { throw new RangeError( - `The status provided (${init.status}) is outside the range [200, 599].`, + `The status provided (${init.status}) is not equal to 101 and outside the range [200, 599].`, ); } |