From 70927560f6581a6b670765f0ff141f0b171caee0 Mon Sep 17 00:00:00 2001 From: Yohanan Baruchel Date: Mon, 5 Oct 2020 23:54:47 +0300 Subject: [PATCH] lib: change http client path assignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - change http client path assignment from to (it's more appropriate in this case). - since the inner condition is the only referencing the variable, moved the assignment to the inner condition. PR-URL: https://github.com/nodejs/node/pull/35508 Reviewed-By: Rich Trott Reviewed-By: Gerhard Stöbich Reviewed-By: Ricky Zhou <0x19951125@gmail.com> --- lib/_http_client.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index ef103314800ce3..7b1232f33f0a9b 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -145,9 +145,8 @@ function ClientRequest(input, options, cb) { if (this.agent && this.agent.protocol) expectedProtocol = this.agent.protocol; - let path; if (options.path) { - path = String(options.path); + const path = String(options.path); if (INVALID_PATH_REGEX.test(path)) throw new ERR_UNESCAPED_CHARACTERS('Request path'); }