From 2a0e5de16367828f1222830e930721386e26f90b Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Mon, 11 Sep 2023 16:36:00 +0800 Subject: [PATCH] debugger: use `internal/url.URL` instead of `url.parse` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/49590 Reviewed-By: Yagiz Nizipli Reviewed-By: Chemi Atlow Reviewed-By: Geoffrey Booth Reviewed-By: Antoine du Hamel Reviewed-By: Michaƫl Zasso Reviewed-By: Luigi Pinca --- lib/internal/debugger/inspect_client.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/internal/debugger/inspect_client.js b/lib/internal/debugger/inspect_client.js index e467899fb3e..315617bf08a 100644 --- a/lib/internal/debugger/inspect_client.js +++ b/lib/internal/debugger/inspect_client.js @@ -15,7 +15,7 @@ const crypto = require('crypto'); const { ERR_DEBUGGER_ERROR } = require('internal/errors').codes; const { EventEmitter } = require('events'); const http = require('http'); -const URL = require('url'); +const { URL } = require('internal/url'); const debuglog = require('internal/util/debuglog').debuglog('inspect'); @@ -297,7 +297,8 @@ class Client extends EventEmitter { async _discoverWebsocketPath() { const { 0: { webSocketDebuggerUrl } } = await this._fetchJSON('/json'); - return URL.parse(webSocketDebuggerUrl).path; + const { pathname, search } = new URL(webSocketDebuggerUrl); + return `${pathname}${search}`; } _connectWebsocket(urlPath) {