From b5e9fb68ed4e0e4d5b0914403a23cecd4c4db0e7 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` --- 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 e467899fb3e746..315617bf08a800 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) {