Skip to content

Replace usage of old node:url api with WHATWG one in pushgateway.js#744

Open
yvon-morice-wmx wants to merge 2 commits into
prometheus:mainfrom
yvon-morice-wmx:replace-usage-of-legacy-node-url
Open

Replace usage of old node:url api with WHATWG one in pushgateway.js#744
yvon-morice-wmx wants to merge 2 commits into
prometheus:mainfrom
yvon-morice-wmx:replace-usage-of-legacy-node-url

Conversation

@yvon-morice-wmx

Copy link
Copy Markdown

Related to #743

Replaces usage of url.urlParse and url.resolve from node:url by new url.Url from same package as these functions have been deprecated and trigger a warning on usage.

Changes based on code and documentation available at https://nodejs.org/api/url.html#urlresolvefrom-to and https://github.com/nodejs/userland-migrations/tree/main/recipes/node-url-to-whatwg-url

Comment thread lib/pushgateway.js

function legacyUrlFromWhatwgUrl(whatwgUrl) {
const legacyUrl = {
hash: whatwgUrl.hash,

@jdmarshall jdmarshall Jul 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you're going to go through the trouble of unwinding URL->url attribute copying it'd be better off to work with URL internally and just do the jiggery pokery for forwarding the old style requestOptions over the top, so we don't round-trip to the legacyUrlResolve function twice.

@yvon-morice-wmx yvon-morice-wmx force-pushed the replace-usage-of-legacy-node-url branch 2 times, most recently from 5e0afa6 to 88ee2ba Compare July 1, 2026 07:30
Signed-off-by: Yvon Morice <yvon.morice@winamax.fr>
Signed-off-by: Yvon Morice <yvon.morice@winamax.fr>
@yvon-morice-wmx yvon-morice-wmx force-pushed the replace-usage-of-legacy-node-url branch from c8c2194 to 1079eb3 Compare July 1, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants