Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

whut
Copy link

@whut whut commented Jul 17, 2023

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

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/http
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added https Issues or PRs related to the https subsystem. needs-ci PRs that need a full CI run. labels Jul 17, 2023
Copy link
Member

@mcollina mcollina left a 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?

@whut
Copy link
Author

whut commented Jul 17, 2023

@mcollina test added, based on test-https-client-override-global-agent.js

@whut whut requested a review from mcollina July 17, 2023 09:01
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 17, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 17, 2023
@nodejs-github-bot
Copy link
Collaborator

@targos
Copy link
Member

targos commented Jul 17, 2023

Does it already work correctly with http.globalAgent ?

@whut
Copy link
Author

whut commented Jul 17, 2023

Does it already work correctly with http.globalAgent ?

Yes, because it already use accessor property

@whut
Copy link
Author

whut commented Jul 18, 2023

@mcollina I fixed the build failure, I sadly missed to add one "import" of primordial

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 18, 2023
@mcollina
Copy link
Member

The linter is failing.

@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 18, 2023
@nodejs-github-bot
Copy link
Collaborator

Copy link
Contributor

@ShogunPanda ShogunPanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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
@whut
Copy link
Author

whut commented Jul 20, 2023

@mcollina I only now run the test locally, and fixed imports in it to work under ECMAScript modules (e.g. ... from '../common/' to ... from '../common/index.mjs'. Test now pass, and linter is also happy:)

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 20, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 20, 2023
@nodejs-github-bot
Copy link
Collaborator

@mcollina
Copy link
Member

Copy link
Contributor

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.

@ShogunPanda
Copy link
Contributor

@whut Any interest on delivering this? Can you please rebase this PR after the last main branch so we can run CI again?

@RedYetiDev RedYetiDev closed this Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
https Issues or PRs related to the https subsystem. needs-ci PRs that need a full CI run. stalled Issues and PRs that are stalled.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants