From 2a61b5fdd444c4b6f47f0e0bfbafe0bd26789d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Fri, 23 Dec 2022 17:39:14 +0100 Subject: fix(ext/fetch): Guard against invalid URL before its used by reqwest (#17164) --- cli/tests/unit/fetch_test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cli/tests') 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(); -- cgit v1.2.3