From 8834fbbb48212b01280b26458266da8aba294556 Mon Sep 17 00:00:00 2001 From: Mriganshu Bora Date: Sat, 11 Apr 2026 11:30:44 +0530 Subject: [PATCH] fix: replace deprecated url.parse() with new URL() --- src/web-push-lib.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/web-push-lib.js b/src/web-push-lib.js index a47df054..8172d719 100644 --- a/src/web-push-lib.js +++ b/src/web-push-lib.js @@ -271,7 +271,7 @@ WebPushLib.prototype.generateRequestDetails = function(subscription, payload, op requestDetails.headers.Authorization = 'key=' + currentGCMAPIKey; } } else if (currentVapidDetails) { - const parsedUrl = url.parse(subscription.endpoint); + const parsedUrl = new URL(subscription.endpoint); const audience = parsedUrl.protocol + '//' + parsedUrl.host; @@ -345,7 +345,7 @@ WebPushLib.prototype.sendNotification = function(subscription, payload, options) return new Promise(function(resolve, reject) { const httpsOptions = {}; - const urlParts = url.parse(requestDetails.endpoint); + const urlParts = new URL(requestDetails.endpoint); httpsOptions.hostname = urlParts.hostname; httpsOptions.port = urlParts.port; httpsOptions.path = urlParts.path;