Skip to content

Commit b1911e0

Browse files
committed
refactor: code
1 parent 6f76b49 commit b1911e0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/Server.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -755,11 +755,8 @@ class Server {
755755
}
756756
}
757757

758-
listen(port, hostname = this.options.host, fn) {
759-
if (
760-
typeof this.options.host !== 'undefined' &&
761-
hostname !== this.options.host
762-
) {
758+
listen(port, hostname, fn) {
759+
if (typeof hostname !== 'undefined' && hostname !== this.options.host) {
763760
throw new Error(
764761
'The host specified in options is different from the host passed as an argument.'
765762
);
@@ -771,6 +768,8 @@ class Server {
771768
);
772769
}
773770

771+
hostname = this.options.host;
772+
774773
if (hostname === 'local-ip') {
775774
this.options.host =
776775
internalIp.v4.sync() || internalIp.v6.sync() || '0.0.0.0';

test/server/Server.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jest.mock('sockjs/lib/transport');
1212

1313
const baseDevConfig = {
1414
port,
15+
host: 'localhost',
1516
static: false,
1617
};
1718

0 commit comments

Comments
 (0)