Skip to content

Commit 882d62d

Browse files
committed
refactor to use validateObject
1 parent 59dbe4b commit 882d62d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/_http_server.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ const {
7575
ERR_HTTP_HEADERS_SENT,
7676
ERR_HTTP_INVALID_STATUS_CODE,
7777
ERR_HTTP_SOCKET_ENCODING,
78-
ERR_INVALID_ARG_TYPE,
7978
ERR_INVALID_ARG_VALUE,
8079
ERR_INVALID_CHAR
8180
} = codes;
@@ -503,10 +502,10 @@ function Server(options, requestListener) {
503502
if (typeof options === 'function') {
504503
requestListener = options;
505504
options = {};
506-
} else if (options == null || (typeof options === 'object' && !ArrayIsArray(options))) {
507-
options = { ...options };
505+
} else if (options == null) {
506+
options = {};
508507
} else {
509-
throw new ERR_INVALID_ARG_TYPE('options', 'object', options);
508+
validateObject(options, 'options');
510509
}
511510

512511
storeHTTPOptions.call(this, options);

0 commit comments

Comments
 (0)