diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Cargo.toml | 1 | ||||
-rw-r--r-- | tests/integration/inspector_tests.rs | 2 | ||||
-rw-r--r-- | tests/integration/npm_tests.rs | 2 | ||||
-rw-r--r-- | tests/integration/run_tests.rs | 2 | ||||
-rw-r--r-- | tests/integration/serve_tests.rs | 1 | ||||
-rw-r--r-- | tests/specs/cert/localhost_unsafe_ssl/localhost_unsafe_ssl.ts.out | 2 | ||||
-rw-r--r-- | tests/testdata/run/fetch_async_error_stack.ts.out | 2 | ||||
-rw-r--r-- | tests/unit/fetch_test.ts | 28 | ||||
-rw-r--r-- | tests/unit/http_test.ts | 16 | ||||
-rw-r--r-- | tests/unit/serve_test.ts | 4 |
10 files changed, 27 insertions, 33 deletions
diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 34cffbb40..9d513571b 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -53,7 +53,6 @@ once_cell.workspace = true os_pipe.workspace = true pretty_assertions.workspace = true regex.workspace = true -reqwest.workspace = true serde.workspace = true test_util.workspace = true tokio.workspace = true diff --git a/tests/integration/inspector_tests.rs b/tests/integration/inspector_tests.rs index fa1b3a9d8..57831ab46 100644 --- a/tests/integration/inspector_tests.rs +++ b/tests/integration/inspector_tests.rs @@ -6,7 +6,7 @@ use deno_core::error::AnyError; use deno_core::serde_json; use deno_core::serde_json::json; use deno_core::url; - +use deno_fetch::reqwest; use fastwebsockets::FragmentCollector; use fastwebsockets::Frame; use fastwebsockets::WebSocket; diff --git a/tests/integration/npm_tests.rs b/tests/integration/npm_tests.rs index dba519087..82f0697d5 100644 --- a/tests/integration/npm_tests.rs +++ b/tests/integration/npm_tests.rs @@ -3,7 +3,7 @@ use deno_core::serde_json; use deno_core::serde_json::json; use deno_core::serde_json::Value; - +use deno_fetch::reqwest; use pretty_assertions::assert_eq; use test_util as util; use test_util::itest; diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index 6a9b47b1a..d4d1fea2e 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -11,7 +11,7 @@ use std::sync::Arc; use bytes::Bytes; use deno_core::serde_json::json; use deno_core::url; - +use deno_fetch::reqwest; use deno_tls::rustls; use deno_tls::rustls::ClientConnection; use deno_tls::rustls_pemfile; diff --git a/tests/integration/serve_tests.rs b/tests/integration/serve_tests.rs index 3d64ce3a3..85de068c9 100644 --- a/tests/integration/serve_tests.rs +++ b/tests/integration/serve_tests.rs @@ -2,6 +2,7 @@ use std::io::Read; +use deno_fetch::reqwest; use pretty_assertions::assert_eq; use regex::Regex; use test_util as util; 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..3067fffae 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) 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..e8169228f 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[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 bc3822d99..b549be9a4 100644 --- a/tests/unit/fetch_test.ts +++ b/tests/unit/fetch_test.ts @@ -67,7 +67,7 @@ Deno.test( await fetch(`http://localhost:${port}`); }, TypeError, - "client error (Connect)", + "error sending request for url", ); }, ); @@ -80,7 +80,7 @@ Deno.test( await fetch("http://nil/"); }, TypeError, - "client error (Connect)", + "error sending request for url", ); }, ); @@ -688,7 +688,7 @@ Deno.test( "accept: */*\r\n", "accept-language: *\r\n", `user-agent: Deno/${Deno.version.deno}\r\n`, - "accept-encoding: gzip,br\r\n", + "accept-encoding: gzip, br\r\n", `host: ${addr}\r\n\r\n`, ].join(""); assertEquals(actual, expected); @@ -720,7 +720,7 @@ Deno.test( "accept: text/html\r\n", "accept-language: en-US\r\n", `user-agent: Deno/${Deno.version.deno}\r\n`, - "accept-encoding: gzip,br\r\n", + "accept-encoding: gzip, br\r\n", `host: ${addr}\r\n\r\n`, ].join(""); assertEquals(actual, expected); @@ -750,16 +750,15 @@ Deno.test( const actual = new TextDecoder().decode((await bufPromise).bytes()); const expected = [ "POST /blah HTTP/1.1\r\n", - `content-length: ${body.length}\r\n`, "hello: World\r\n", "foo: Bar\r\n", "content-type: text/plain;charset=UTF-8\r\n", "accept: */*\r\n", "accept-language: *\r\n", `user-agent: Deno/${Deno.version.deno}\r\n`, - "accept-encoding: gzip,br\r\n", + "accept-encoding: gzip, br\r\n", `host: ${addr}\r\n`, - `\r\n`, + `content-length: ${body.length}\r\n\r\n`, body, ].join(""); assertEquals(actual, expected); @@ -790,15 +789,14 @@ Deno.test( const actual = new TextDecoder().decode((await bufPromise).bytes()); const expected = [ "POST /blah HTTP/1.1\r\n", - `content-length: ${body.byteLength}\r\n`, "hello: World\r\n", "foo: Bar\r\n", "accept: */*\r\n", "accept-language: *\r\n", `user-agent: Deno/${Deno.version.deno}\r\n`, - "accept-encoding: gzip,br\r\n", + "accept-encoding: gzip, br\r\n", `host: ${addr}\r\n`, - `\r\n`, + `content-length: ${body.byteLength}\r\n\r\n`, bodyStr, ].join(""); assertEquals(actual, expected); @@ -829,7 +827,7 @@ Deno.test( "accept: */*\r\n", "accept-language: *\r\n", `user-agent: Deno/${Deno.version.deno}\r\n`, - "accept-encoding: gzip,br\r\n", + "accept-encoding: gzip, br\r\n", `host: ${addr}\r\n\r\n`, ].join(""); assertEquals(actual, expected); @@ -861,7 +859,7 @@ Deno.test( "accept: */*\r\n", "accept-language: *\r\n", `user-agent: Deno/${Deno.version.deno}\r\n`, - "accept-encoding: gzip,br\r\n\r\n", + "accept-encoding: gzip, br\r\n\r\n", ].join(""); assertEquals(actual, expected); }, @@ -1228,7 +1226,7 @@ Deno.test( "accept: */*\r\n", "accept-language: *\r\n", `user-agent: Deno/${Deno.version.deno}\r\n`, - "accept-encoding: gzip,br\r\n", + "accept-encoding: gzip, br\r\n", `host: ${addr}\r\n`, `transfer-encoding: chunked\r\n\r\n`, "B\r\n", @@ -1826,7 +1824,7 @@ Deno.test( await fetch(`http://${addr}/`); }, TypeError, - "client error", + "error sending request", ); listener.close(); @@ -1882,7 +1880,7 @@ Deno.test( await response.arrayBuffer(); }, Error, - "body", + "error decoding response body", ); listener.close(); diff --git a/tests/unit/http_test.ts b/tests/unit/http_test.ts index 03c30965f..eddb1520b 100644 --- a/tests/unit/http_test.ts +++ b/tests/unit/http_test.ts @@ -2572,11 +2572,9 @@ for (const compression of [true, false]) { const result = await reader.read(); assert(!result.done); assertEquals(result.value, new Uint8Array([65])); - await assertRejects( - () => reader.read(), - TypeError, - "body", - ); + const err = await assertRejects(() => reader.read()); + assert(err instanceof TypeError); + assert(err.message.includes("error decoding response body")); const httpConn = await server; httpConn.close(); @@ -2610,11 +2608,9 @@ for (const compression of [true, false]) { const result = await reader.read(); assert(!result.done); assertEquals(result.value, new Uint8Array([65])); - await assertRejects( - () => reader.read(), - TypeError, - "body", - ); + const err = await assertRejects(() => reader.read()); + assert(err instanceof TypeError); + assert(err.message.includes("error decoding response body")); const httpConn = await server; httpConn.close(); diff --git a/tests/unit/serve_test.ts b/tests/unit/serve_test.ts index ee87d8189..4239221be 100644 --- a/tests/unit/serve_test.ts +++ b/tests/unit/serve_test.ts @@ -3522,7 +3522,7 @@ Deno.test( fail(); } catch (clientError) { assert(clientError instanceof TypeError); - assert(clientError.message.includes("client error")); + assert(clientError.message.includes("error sending request for url")); } finally { ac.abort(); await server.finished; @@ -3570,7 +3570,7 @@ Deno.test({ fail(); } catch (clientError) { assert(clientError instanceof TypeError); - assert(clientError.message.includes("client error")); + assert(clientError.message.includes("error sending request for url")); } finally { ac.abort(); await server.finished; |