Skip to content

Commit 6c76d31

Browse files
committedSep 20, 2023
fix: apply default localhost in internal generateURL util
1 parent 2fcc7c3 commit 6c76d31

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed
 

‎src/_utils.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ export function generateURL(
7070
hostname = `[${hostname}]`;
7171
}
7272
return (
73-
proto + hostname + ":" + port + (baseURL || listhenOptions.baseURL || "")
73+
proto +
74+
(hostname || "localhost") +
75+
":" +
76+
port +
77+
(baseURL || listhenOptions.baseURL || "")
7478
);
7579
}
7680

‎src/listen.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,8 @@ export async function listen(
130130
}
131131

132132
// --- GetURL Utility ---
133-
const getURL = (
134-
host = listhenOptions.hostname || "localhost",
135-
baseURL?: string,
136-
) => generateURL(host, listhenOptions, baseURL);
133+
const getURL = (host = listhenOptions.hostname, baseURL?: string) =>
134+
generateURL(host, listhenOptions, baseURL);
137135

138136
// --- Start Tunnel ---
139137
let tunnel: Tunnel | undefined;

0 commit comments

Comments
 (0)
Please sign in to comment.