From 59b738e44f70055755117916e63bfd41f332bb29 Mon Sep 17 00:00:00 2001 From: "suk.bear" Date: Thu, 2 Jan 2025 08:30:38 +0800 Subject: [PATCH] fix: proxy url global setting --- src/test-utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test-utils.ts b/src/test-utils.ts index 630f950..fea4dc9 100644 --- a/src/test-utils.ts +++ b/src/test-utils.ts @@ -1,4 +1,4 @@ -import { ProxyAgent } from 'undici'; +import { ProxyAgent,setGlobalDispatcher } from 'undici'; import { Scraper } from './scraper'; import fs from 'fs'; @@ -96,6 +96,8 @@ export async function getScraper( } agent = new ProxyAgent(agentOptions); + + setGlobalDispatcher(agent) } const scraper = new Scraper({