You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var SUPPORTS_OPTIONS = ( parseInt( NODE_VERSION.split( '.' )[ 0 ], 10 ) >= 8 ); // TODO: this is an imperfect test, as options only added in v8.12.0/v9.6.0
544
554
555
+
var EXCLUDE_OPTIONS = [
556
+
'port',
557
+
'maxport',
558
+
'hostname',
559
+
'address'
560
+
];
561
+
545
562
546
563
// MAIN //
547
564
548
565
/**
549
566
* Returns a function which creates an HTTP server.
550
567
*
568
+
* ## Notes
569
+
*
570
+
* - In addition to options documented below, the function supports any options supported by `http.createServer`. Which server options are supported depends on the Node.js version. Older Node.js versions (e.g., <= v8.12.0) do not support an options object when calling `http.createServer`, and, for those versions, any options specific to Node.js are ignored.
571
+
*
551
572
* @param {Options} [options] - server options
552
573
* @param {NonNegativeInteger} [options.port=0] - server port
553
574
* @param {NonNegativeInteger} [options.maxport] - max server port
}<spanclass="branch-0 cbranch-no" title="branch not covered" > else {</span>
666
-
<spanclass="cstat-no" title="statement not covered" > opts = options;</span>
667
-
<spanclass="cstat-no" title="statement not covered" > if ( !isObject( opts ) ) {</span>
668
-
<spanclass="cstat-no" title="statement not covered" > throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );</span>
669
-
<spanclass="cstat-no" title="statement not covered" > }</span>
670
-
<spanclass="cstat-no" title="statement not covered" > cb = done;</span>
671
-
<spanclass="cstat-no" title="statement not covered" > }</span>
672
-
if ( !isFunction( cb ) ) {
673
-
throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', cb ) );
687
+
if ( !isFunction( done ) ) {
688
+
throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', done ) );
674
689
}
675
690
if ( requestListener ) {
676
691
if ( SUPPORTS_OPTIONS ) {
677
-
server = http.createServer( opts, requestListener );
692
+
server = http.createServer( sopts, requestListener );
678
693
}<spanclass="branch-0 cbranch-no" title="branch not covered" > else {</span>
679
694
<spanclass="cstat-no" title="statement not covered" > server = http.createServer( requestListener );</span>
680
695
<spanclass="cstat-no" title="statement not covered" > }</span>
681
696
} else if ( SUPPORTS_OPTIONS ) {
682
-
server = http.createServer( opts );
697
+
server = http.createServer( sopts );
683
698
}<spanclass="branch-0 cbranch-no" title="branch not covered" > else {</span>
684
699
<spanclass="cstat-no" title="statement not covered" > server = http.createServer();</span>
685
700
<spanclass="cstat-no" title="statement not covered" > }</span>
0 commit comments