From b87939cf53dff3197f44b2885ae28ecbff63553a Mon Sep 17 00:00:00 2001 From: leeseean Date: Tue, 14 Nov 2017 16:15:25 +0800 Subject: [PATCH] http: use strict comparison PR-URL: https://github.com/nodejs/node/pull/17011 Reviewed-By: Anna Henningsen Reviewed-By: Tiancheng "Timothy" Gu --- lib/_http_client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index 8031826d5351b8..2287c2751b8ce6 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -70,7 +70,7 @@ function isInvalidPath(s) { } function validateHost(host, name) { - if (host != null && typeof host !== 'string') { + if (host !== null && host !== undefined && typeof host !== 'string') { throw new errors.TypeError('ERR_INVALID_ARG_TYPE', `options.${name}`, ['string', 'undefined', 'null'], host); } @@ -145,7 +145,7 @@ function ClientRequest(options, cb) { var method = options.method; var methodIsString = (typeof method === 'string'); - if (method != null && !methodIsString) { + if (method !== null && method !== undefined && !methodIsString) { throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'method', 'string', method); }