Skip to content

Commit

Permalink
refactor to use validateObject
Browse files Browse the repository at this point in the history
  • Loading branch information
deokjinkim committed Jan 22, 2023
1 parent 59dbe4b commit 882d62d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const {
ERR_HTTP_HEADERS_SENT,
ERR_HTTP_INVALID_STATUS_CODE,
ERR_HTTP_SOCKET_ENCODING,
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
ERR_INVALID_CHAR
} = codes;
Expand Down Expand Up @@ -503,10 +502,10 @@ function Server(options, requestListener) {
if (typeof options === 'function') {
requestListener = options;
options = {};
} else if (options == null || (typeof options === 'object' && !ArrayIsArray(options))) {
options = { ...options };
} else if (options == null) {
options = {};
} else {
throw new ERR_INVALID_ARG_TYPE('options', 'object', options);
validateObject(options, 'options');
}

storeHTTPOptions.call(this, options);
Expand Down

0 comments on commit 882d62d

Please sign in to comment.