lib: change http client path assignment

- 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 <rtrott@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
This commit is contained in:
Yohanan Baruchel
2020-10-05 23:54:47 +03:00
committed by Node.js GitHub Bot
parent 4e9f3cc6fe
commit f512ce6aa0

View File

@@ -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');
}