mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
fix(op_crates/fetch): check fetch() argument length (#10474)
This commit is contained in:
parent
ea917384fe
commit
688557e226
3 changed files with 12 additions and 2 deletions
|
@ -9,6 +9,16 @@ import {
|
|||
} from "./test_util.ts";
|
||||
import { Buffer } from "../../../test_util/std/io/buffer.ts";
|
||||
|
||||
unitTest(
|
||||
{ perms: { net: true } },
|
||||
async function fetchRequiresOneArgument(): Promise<void> {
|
||||
await assertThrowsAsync(
|
||||
fetch as unknown as () => Promise<void>,
|
||||
TypeError,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
unitTest({ perms: { net: true } }, async function fetchProtocolError(): Promise<
|
||||
void
|
||||
> {
|
||||
|
|
|
@ -273,6 +273,7 @@
|
|||
*/
|
||||
async function fetch(input, init = {}) {
|
||||
const prefix = "Failed to call 'fetch'";
|
||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||
input = webidl.converters["RequestInfo"](input, {
|
||||
prefix,
|
||||
context: "Argument 1",
|
||||
|
|
|
@ -1014,7 +1014,6 @@
|
|||
"Response interface: operation json()",
|
||||
"Response interface: operation text()",
|
||||
"Response interface: calling redirect(USVString, optional unsigned short) on new Response() with too few arguments must throw TypeError",
|
||||
"Window interface: calling fetch(RequestInfo, optional RequestInit) on window with too few arguments must throw TypeError",
|
||||
"Window interface: operation fetch(RequestInfo, optional RequestInit)"
|
||||
]
|
||||
},
|
||||
|
@ -1101,4 +1100,4 @@
|
|||
"set.any.js": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue