summaryrefslogtreecommitdiffstats
path: root/test/fetch/issue-node-46525.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/fetch/issue-node-46525.js')
-rw-r--r--test/fetch/issue-node-46525.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/fetch/issue-node-46525.js b/test/fetch/issue-node-46525.js
new file mode 100644
index 0000000..6fd9810
--- /dev/null
+++ b/test/fetch/issue-node-46525.js
@@ -0,0 +1,28 @@
+'use strict'
+
+const { once } = require('events')
+const { createServer } = require('http')
+const { test } = require('tap')
+const { fetch } = require('../..')
+
+// https://github.com/nodejs/node/issues/46525
+test('No warning when reusing AbortController', async (t) => {
+ function onWarning (error) {
+ t.error(error, 'Got warning')
+ }
+
+ const server = createServer((req, res) => res.end()).listen(0)
+
+ await once(server, 'listening')
+
+ process.on('warning', onWarning)
+ t.teardown(() => {
+ process.off('warning', onWarning)
+ return server.close()
+ })
+
+ const controller = new AbortController()
+ for (let i = 0; i < 15; i++) {
+ await fetch(`http://localhost:${server.address().port}`, { signal: controller.signal })
+ }
+})