blob: e5a86abeaf3a9f3200f91d753bddddbe99a8e613 (
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
|
'use strict'
const { test } = require('tap')
const { createServer } = require('http')
const { once } = require('events')
const { fetch } = require('../..')
const { JSDOM } = require('jsdom')
// https://github.com/nodejs/undici/pull/1910#issuecomment-1464495619
test('third party AbortControllers', async (t) => {
const server = createServer((_, res) => res.end()).listen(0)
const { AbortController } = new JSDOM().window
let controller = new AbortController()
t.teardown(() => {
controller.abort()
controller = null
return server.close()
})
await once(server, 'listening')
await t.resolves(fetch(`http://localhost:${server.address().port}`, {
signal: controller.signal
}))
})
|