summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/specs/cert/localhost_unsafe_ssl/localhost_unsafe_ssl.ts.out2
-rw-r--r--tests/testdata/run/fetch_async_error_stack.ts.out2
-rw-r--r--tests/unit/fetch_test.ts26
3 files changed, 22 insertions, 8 deletions
diff --git a/tests/specs/cert/localhost_unsafe_ssl/localhost_unsafe_ssl.ts.out b/tests/specs/cert/localhost_unsafe_ssl/localhost_unsafe_ssl.ts.out
index f98c7e4e4..c7bdfde0e 100644
--- a/tests/specs/cert/localhost_unsafe_ssl/localhost_unsafe_ssl.ts.out
+++ b/tests/specs/cert/localhost_unsafe_ssl/localhost_unsafe_ssl.ts.out
@@ -1,3 +1,3 @@
DANGER: TLS certificate validation is disabled for: deno.land
-error: Import 'https://localhost:5545/subdir/mod2.ts' failed: client error[WILDCARD]
+error: Import 'https://localhost:5545/subdir/mod2.ts' failed: error sending request for url (https://localhost:5545/subdir/mod2.ts): client error[WILDCARD]
at file:///[WILDCARD]/cafile_url_imports.ts:[WILDCARD]
diff --git a/tests/testdata/run/fetch_async_error_stack.ts.out b/tests/testdata/run/fetch_async_error_stack.ts.out
index 06d92d15a..2722cc8a7 100644
--- a/tests/testdata/run/fetch_async_error_stack.ts.out
+++ b/tests/testdata/run/fetch_async_error_stack.ts.out
@@ -1,4 +1,4 @@
-error: Uncaught (in promise) TypeError: client error[WILDCARD]
+error: Uncaught (in promise) TypeError: error sending request for url (https://nonexistent.deno.land/): client error[WILDCARD]
await fetch("https://nonexistent.deno.land/");
^[WILDCARD]
at async fetch (ext:[WILDCARD])
diff --git a/tests/unit/fetch_test.ts b/tests/unit/fetch_test.ts
index 09cbb5cd2..5ebc0c86f 100644
--- a/tests/unit/fetch_test.ts
+++ b/tests/unit/fetch_test.ts
@@ -1976,14 +1976,17 @@ Deno.test(
},
});
- const err = await assertRejects(() =>
- fetch(`http://localhost:${listenPort}/`, {
- body: stream,
- method: "POST",
- })
+ const url = `http://localhost:${listenPort}/`;
+ const err = await assertRejects(
+ () =>
+ fetch(url, {
+ body: stream,
+ method: "POST",
+ }),
+ TypeError,
+ `error sending request for url (${url}): client error (SendRequest): error from user's Body stream`,
);
- assert(err instanceof TypeError, `err was not a TypeError ${err}`);
assert(err.cause, `err.cause was null ${err}`);
assert(
err.cause instanceof Error,
@@ -2060,3 +2063,14 @@ Deno.test("URL authority is used as 'Authorization' header", async () => {
await server.finished;
assertEquals(authHeader, "Basic ZGVubzpsYW5k");
});
+
+Deno.test(
+ { permissions: { net: true } },
+ async function errorMessageIncludesUrlAndDetails() {
+ await assertRejects(
+ () => fetch("http://example.invalid"),
+ TypeError,
+ "error sending request for url (http://example.invalid/): client error (Connect): dns error: ",
+ );
+ },
+);