Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ function Server(options, requestListener) {
if (typeof options === 'function') {
requestListener = options;
options = {};
} else if (options == null || typeof options === 'object') {
} else if (options == null || (typeof options === 'object' && !ArrayIsArray(options))) {
options = { ...options };
} else {
throw new ERR_INVALID_ARG_TYPE('options', 'object', options);
Comment thread
aduh95 marked this conversation as resolved.
Outdated
Expand Down
5 changes: 1 addition & 4 deletions test/parallel/test-http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ const http = require('http');
const url = require('url');
const qs = require('querystring');

// TODO: documentation does not allow Array as an option, so testing that
// should fail, but currently http.Server does not typecheck further than
// if `option` is `typeof object` - so we don't test that here right now
const invalid_options = [ 'foo', 42, true ];
const invalid_options = [ 'foo', 42, true, [] ];

invalid_options.forEach((option) => {
assert.throws(() => {
Expand Down