summaryrefslogtreecommitdiffstats
path: root/test/connect-abort.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 20:56:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 20:56:19 +0000
commit0b6210cd37b68b94252cb798598b12974a20e1c1 (patch)
treee371686554a877842d95aa94f100bee552ff2a8e /test/connect-abort.js
parentInitial commit. (diff)
downloadnode-undici-upstream.tar.xz
node-undici-upstream.zip
Adding upstream version 5.28.2+dfsg1+~cs23.11.12.3.upstream/5.28.2+dfsg1+_cs23.11.12.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/connect-abort.js')
-rw-r--r--test/connect-abort.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/connect-abort.js b/test/connect-abort.js
new file mode 100644
index 0000000..6eb3624
--- /dev/null
+++ b/test/connect-abort.js
@@ -0,0 +1,28 @@
+'use strict'
+
+const { test } = require('tap')
+const { Client } = require('..')
+const { PassThrough } = require('stream')
+
+test(t => {
+ t.plan(2)
+
+ const client = new Client('http://localhost:1234', {
+ connect: (_, cb) => {
+ client.destroy()
+ cb(null, new PassThrough({
+ destroy (err, cb) {
+ t.same(err?.name, 'ClientDestroyedError')
+ cb(null)
+ }
+ }))
+ }
+ })
+
+ client.request({
+ path: '/',
+ method: 'GET'
+ }, (err, data) => {
+ t.same(err?.name, 'ClientDestroyedError')
+ })
+})