http: use strict comparison
PR-URL: https://github.com/nodejs/node/pull/17011 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
This commit is contained in:
parent
7d2b08a3b5
commit
5164a12618
@ -44,7 +44,7 @@ const errors = require('internal/errors');
|
|||||||
const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/;
|
const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/;
|
||||||
|
|
||||||
function validateHost(host, name) {
|
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}`,
|
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', `options.${name}`,
|
||||||
['string', 'undefined', 'null'], host);
|
['string', 'undefined', 'null'], host);
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ function ClientRequest(options, cb) {
|
|||||||
|
|
||||||
var method = options.method;
|
var method = options.method;
|
||||||
var methodIsString = (typeof method === 'string');
|
var methodIsString = (typeof method === 'string');
|
||||||
if (method != null && !methodIsString) {
|
if (method !== null && method !== undefined && !methodIsString) {
|
||||||
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'method',
|
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'method',
|
||||||
'string', method);
|
'string', method);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user