summaryrefslogtreecommitdiff
path: root/cli/tests/unit/fetch_test.ts
diff options
context:
space:
mode:
authorKamil Ogórek <kamil.ogorek@gmail.com>2022-12-23 17:39:14 +0100
committerGitHub <noreply@github.com>2022-12-23 17:39:14 +0100
commit2a61b5fdd444c4b6f47f0e0bfbafe0bd26789d68 (patch)
tree0ea6ef228d7c85ec8b206197fd0fddf29fc29a2b /cli/tests/unit/fetch_test.ts
parente58cdbcb4b8943eaa344a597f5c868e1ef4070d4 (diff)
fix(ext/fetch): Guard against invalid URL before its used by reqwest (#17164)
Diffstat (limited to 'cli/tests/unit/fetch_test.ts')
-rw-r--r--cli/tests/unit/fetch_test.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts
index b755e8ec9..500891e08 100644
--- a/cli/tests/unit/fetch_test.ts
+++ b/cli/tests/unit/fetch_test.ts
@@ -93,6 +93,19 @@ Deno.test(
},
);
+Deno.test(
+ { permissions: { net: true } },
+ async function fetchMalformedUriError() {
+ await assertRejects(
+ async () => {
+ const url = new URL("http://{{google/");
+ await fetch(url);
+ },
+ TypeError,
+ );
+ },
+);
+
Deno.test({ permissions: { net: true } }, async function fetchJsonSuccess() {
const response = await fetch("http://localhost:4545/assets/fixture.json");
const json = await response.json();