Skip to content

Commit

Permalink
fix: apply default localhost in internal generateURL util
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 20, 2023
1 parent 2fcc7c3 commit 6c76d31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/_utils.ts
Expand Up @@ -70,7 +70,11 @@ export function generateURL(
hostname = `[${hostname}]`;
}
return (
proto + hostname + ":" + port + (baseURL || listhenOptions.baseURL || "")
proto +
(hostname || "localhost") +
":" +
port +
(baseURL || listhenOptions.baseURL || "")
);
}

Expand Down
6 changes: 2 additions & 4 deletions src/listen.ts
Expand Up @@ -130,10 +130,8 @@ export async function listen(
}

// --- GetURL Utility ---
const getURL = (
host = listhenOptions.hostname || "localhost",
baseURL?: string,
) => generateURL(host, listhenOptions, baseURL);
const getURL = (host = listhenOptions.hostname, baseURL?: string) =>
generateURL(host, listhenOptions, baseURL);

// --- Start Tunnel ---
let tunnel: Tunnel | undefined;
Expand Down

0 comments on commit 6c76d31

Please sign in to comment.