-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
WIP: feat: add urllib4 fetch #5425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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({}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line
FetchFactory = FetchFactory;
creates a class property with the same name as the imported module. While this makesurllib.FetchFactory
accessible viathis.FetchFactory
, it can be slightly confusing due to the identical naming. Consider if an alias (e.g.,urllibFetchFactory
) would improve clarity, or ifFetchFactory
needs to be a class property at all if onlyfetch
andsetClientOptions
are used directly on the imported module.