From 66fb9e68f89ddcdb47ed38c07c4aa6c2efc86159 Mon Sep 17 00:00:00 2001 From: killagu Date: Thu, 3 Jul 2025 13:41:14 +0800 Subject: [PATCH] feat: add urllib4 fetch --- src/lib/egg.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/egg.ts b/src/lib/egg.ts index 9e2ad1028a..376debc787 100644 --- a/src/lib/egg.ts +++ b/src/lib/egg.ts @@ -36,6 +36,7 @@ import { type HttpClientRequestOptions, type HttpClientRequestURL, type HttpClientResponse, type HttpClientOptions, } from './core/httpclient.js'; +import { FetchFactory } from 'urllib'; import { createLoggers } from './core/logger.js'; import { convertObject } from './core/utils.js'; import { BaseContextClass } from './core/base_context_class.js'; @@ -146,6 +147,8 @@ export class EggApplicationCore extends EggCore { agent?: Agent; application?: Application; declare loader: EggApplicationLoader; + FetchFactory = FetchFactory; + fetch = FetchFactory.fetch; /** * @class @@ -178,6 +181,7 @@ export class EggApplicationCore extends EggCore { this.lifecycle.registerBeforeStart(async () => { await this.load(); }, 'load files'); + this.FetchFactory.setClientOptions({}); } /**