From 41f8988dc7f7e307af28af52e6d89469c824f214 Mon Sep 17 00:00:00 2001 From: Yazan AbdAl-Rahman Date: Mon, 29 Jul 2024 00:04:05 +0300 Subject: fix(http): Adjust hostname display for Windows when using 0.0.0.0 (#24698) Fixes #24687 --------- Co-authored-by: Yoshiya Hinosawa --- ext/http/00_serve.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/http/00_serve.ts b/ext/http/00_serve.ts index 670b64676..a58d19d76 100644 --- a/ext/http/00_serve.ts +++ b/ext/http/00_serve.ts @@ -657,7 +657,8 @@ function serve(arg1, arg2) { // If the hostname is "0.0.0.0", we display "localhost" in console // because browsers in Windows don't resolve "0.0.0.0". // See the discussion in https://github.com/denoland/deno_std/issues/1165 - const hostname = addr.hostname == "0.0.0.0" || addr.hostname == "::" + const hostname = (addr.hostname == "0.0.0.0" || addr.hostname == "::") && + (Deno.build.os === "windows") ? "localhost" : addr.hostname; addr.hostname = hostname; -- cgit v1.2.3