Skip to content

Commit fd3aa03

Browse files
leeseeanevanlucas
authored andcommitted
http: use strict comparison
PR-URL: #17011 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
1 parent aa96858 commit fd3aa03

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/_http_client.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function isInvalidPath(s) {
7070
}
7171

7272
function validateHost(host, name) {
73-
if (host != null && typeof host !== 'string') {
73+
if (host !== null && host !== undefined && typeof host !== 'string') {
7474
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', `options.${name}`,
7575
['string', 'undefined', 'null'], host);
7676
}
@@ -145,7 +145,7 @@ function ClientRequest(options, cb) {
145145

146146
var method = options.method;
147147
var methodIsString = (typeof method === 'string');
148-
if (method != null && !methodIsString) {
148+
if (method !== null && method !== undefined && !methodIsString) {
149149
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'method',
150150
'string', method);
151151
}

0 commit comments

Comments
 (0)