mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
feat(ext/fetch): Allow Response status 101 (#13969)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
parent
426ca98527
commit
45b3aa22c0
2 changed files with 8 additions and 4 deletions
|
@ -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].",
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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].`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue