https: make https.globalAgent overridable also under ECMAScript Modules#48808
https: make https.globalAgent overridable also under ECMAScript Modules#48808whut wants to merge 1 commit intonodejs:mainfrom
Conversation
|
Review requested:
|
mcollina
left a comment
There was a problem hiding this comment.
Thanks for opening a PR! Can you please add a unit test?
4b4dba5 to
54579fb
Compare
|
@mcollina test added, based on test-https-client-override-global-agent.js |
|
Does it already work correctly with |
54579fb to
a0dfaa5
Compare
Yes, because it already use accessor property |
a0dfaa5 to
161b003
Compare
|
@mcollina I fixed the build failure, I sadly missed to add one "import" of primordial |
|
The linter is failing. |
161b003 to
c8c19cd
Compare
Under ECMAScript modules when you do "import * as https from 'https'" you get a new object with properties copied from https module exports. So if this is a regular data property, you will just override a copy, but if this would be a accessor property, we can still access the actual https.globalAgent. Refs: nodejs#25170, nodejs#9386
c8c19cd to
c1381e0
Compare
|
@mcollina I only now run the test locally, and fixed imports in it to work under ECMAScript modules (e.g. |
|
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open. |
|
@whut Any interest on delivering this? Can you please rebase this PR after the last main branch so we can run CI again? |
Under ECMAScript modules when you do "import * as https from 'https'" you get a new object with properties copied from https module exports. So if this is a regular data property, you will just override a copy, but if this would be a accessor property, we can still access the actual https.globalAgent.
Refs: #25170, #9386