http: else case is not reachable · nodejs/node@f3b49cf (original) (raw)

Original file line number Diff line number Diff line change
@@ -47,6 +47,7 @@ const { IncomingMessage } = require('_http_incoming');
47 47 const {
48 48 ERR_HTTP_HEADERS_SENT,
49 49 ERR_HTTP_INVALID_STATUS_CODE,
50 +ERR_INVALID_ARG_TYPE,
50 51 ERR_INVALID_CHAR
51 52 } = require('internal/errors').codes;
52 53 const Buffer = require('buffer').Buffer;
@@ -281,6 +282,8 @@ function Server(options, requestListener) {
281 282 options = {};
282 283 } else if (options == null |
283 284 options = util._extend({}, options);
285 +} else {
286 +throw new ERR_INVALID_ARG_TYPE('options', 'object', options);
284 287 }
285 288
286 289 this[kIncomingMessage] = options.IncomingMessage |