-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
https: make https.globalAgent overridable also under ECMAScript Modules #48808
Conversation
Review requested:
|
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.
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 |
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.
lgtm
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. |
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.
LGTM!
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