forked from nodejs/undici
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathissue-2009.js
More file actions
31 lines (25 loc) · 732 Bytes
/
issue-2009.js
File metadata and controls
31 lines (25 loc) · 732 Bytes
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
29
30
31
'use strict'
const { test } = require('node:test')
const { tspl } = require('@matteo.collina/tspl')
const { fetch } = require('../..')
const { createServer } = require('http')
const { once } = require('events')
test('issue 2009', async (t) => {
const { doesNotReject } = tspl(t, { plan: 10 })
const server = createServer((req, res) => {
res.setHeader('a', 'b')
res.flushHeaders()
res.socket.end()
}).listen(0)
t.after(server.close.bind(server))
await once(server, 'listening')
for (let i = 0; i < 10; i++) {
await doesNotReject(
fetch(`http://localhost:${server.address().port}`).then(
async (resp) => {
await resp.body.cancel('Some message')
}
)
)
}
})