blob: 6eb362438666fd7913c924e6e53eb7997e0e09b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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')
})
})
|