File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -751,13 +751,10 @@ class Server {
751
751
}
752
752
753
753
listen ( port , hostname , fn ) {
754
- if ( hostname === 'local-ip' ) {
755
- this . options . host =
756
- internalIp . v4 . sync ( ) || internalIp . v6 . sync ( ) || '0.0.0.0' ;
757
- } else if ( hostname === 'local-ipv4' ) {
758
- this . options . host = internalIp . v4 . sync ( ) || '0.0.0.0' ;
759
- } else if ( hostname === 'local-ipv6' ) {
760
- this . options . host = internalIp . v6 . sync ( ) || '::' ;
754
+ if ( typeof hostname !== 'undefined' && hostname !== this . options . host ) {
755
+ throw new Error (
756
+ 'The host specified in options is different from the host passed as an argument.'
757
+ ) ;
761
758
}
762
759
763
760
if ( typeof port !== 'undefined' && port !== this . options . port ) {
@@ -766,10 +763,15 @@ class Server {
766
763
) ;
767
764
}
768
765
769
- if ( typeof hostname !== 'undefined' && hostname !== this . options . host ) {
770
- throw new Error (
771
- 'The host specified in options is different from the host passed as an argument.'
772
- ) ;
766
+ if ( hostname === 'local-ip' ) {
767
+ this . options . host =
768
+ internalIp . v4 . sync ( ) || internalIp . v6 . sync ( ) || '0.0.0.0' ;
769
+ } else if ( hostname === 'local-ipv4' ) {
770
+ this . options . host = internalIp . v4 . sync ( ) || '0.0.0.0' ;
771
+ } else if ( hostname === 'local-ipv6' ) {
772
+ this . options . host = internalIp . v6 . sync ( ) || '::' ;
773
+ } else {
774
+ this . options . host = hostname ;
773
775
}
774
776
775
777
return (
You can’t perform that action at this time.
0 commit comments