testing without setGlobalDispatcher

This commit is contained in:
Barış Soner Uşaklı
2026-04-11 09:49:10 -04:00
parent 9dcec43109
commit 6903e9f3ca

View File

@@ -1,7 +1,7 @@
'use strict';
const dns = require('dns').promises;
const { Agent, setGlobalDispatcher } = require('undici');
const { Agent } = require('undici');
const nconf = require('nconf');
const ipaddr = require('ipaddr.js');
const { CookieJar } = require('tough-cookie');
@@ -90,8 +90,6 @@ const dispatcher = new NodeBBAgent({
},
});
setGlobalDispatcher(dispatcher);
async function call(url, method, { body, timeout, jar, ...config } = {}) {
const { ok } = await check(url);
if (!ok) {
@@ -111,6 +109,7 @@ async function call(url, method, { body, timeout, jar, ...config } = {}) {
'user-agent': userAgent,
...config.headers,
},
dispatcher,
};
if (timeout > 0) {
opts.signal = AbortSignal.timeout(timeout);