diff --git a/src/net/http/http.go b/src/net/http/http.go index d346e60646a08e..2eb905f5491ef6 100644 --- a/src/net/http/http.go +++ b/src/net/http/http.go @@ -113,10 +113,7 @@ func hasPort(s string) bool { return strings.LastIndex(s, ":") > strings.LastInd // removeEmptyPort strips the empty port in ":port" to "" // as mandated by RFC 3986 Section 6.2.3. func removeEmptyPort(host string) string { - if hasPort(host) { - return strings.TrimSuffix(host, ":") - } - return host + return strings.TrimSuffix(host, ":") } // isToken reports whether v is a valid token (https://www.rfc-editor.org/rfc/rfc2616#section-2.2).