File tree Expand file tree Collapse file tree 1 file changed +18
-18
lines changed
Expand file tree Collapse file tree 1 file changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -378,28 +378,28 @@ export class RequestExecutor implements IDisposable {
378378 }
379379 }
380380
381- private static async createAgent ( options : Agent . Options ) {
382- try {
383- let AgentInstance ;
384-
381+ private static async createAgent ( options : Agent . Options ) {
385382 try {
386- const undiciModule = await import ( importFix ( "undici" ) ) ;
387- AgentInstance = undiciModule . Agent ;
388- } catch ( err ) {
389- const undiciModule = await import ( "undici" ) ;
390- AgentInstance = undiciModule . Agent ;
391- }
383+ let UndiciAgent ;
392384
393- if ( ! AgentInstance ) {
394- throw new Error ( "Agent not found in undici module" ) ;
395- }
385+ try {
386+ const undiciModule = await import ( importFix ( "undici" ) ) ;
387+ UndiciAgent = undiciModule . Agent ;
388+ } catch ( err ) {
389+ const undiciModule = await import ( "undici" ) ;
390+ UndiciAgent = undiciModule . Agent ;
391+ }
396392
397- return new AgentInstance ( options ) ;
398- } catch ( err ) {
399- // If we can't import undici - we might be in cloudflare env - simply return no-agent.
400- return null ;
393+ if ( ! UndiciAgent ) {
394+ throw new Error ( "Agent not found in undici module" ) ;
395+ }
396+
397+ return new UndiciAgent ( options ) ;
398+ } catch ( err ) {
399+ // If we can't import undici - we might be in cloudflare env - simply return no-agent.
400+ return null ;
401+ }
401402 }
402- }
403403
404404 public getTopologyNodes ( ) : ServerNode [ ] {
405405 const topology = this . getTopology ( ) ;
You can’t perform that action at this time.
0 commit comments