fix host port handling for ipv6 (#16723)

This commit is contained in:
valodzka
2023-04-21 05:53:20 +03:00
committed by GitHub
parent f7730beb64
commit b4e6a70fe6
6 changed files with 32 additions and 8 deletions

View File

@@ -15,6 +15,7 @@ import (
"net/url"
"os"
"reflect"
"strconv"
"strings"
"sync"
"syscall"
@@ -158,7 +159,7 @@ func TestHTTP_AgentJoin(t *testing.T) {
httpTest(t, nil, func(s *TestAgent) {
// Determine the join address
member := s.Agent.Server().LocalMember()
addr := fmt.Sprintf("%s:%d", member.Addr, member.Port)
addr := net.JoinHostPort(member.Addr.String(), strconv.Itoa(int(member.Port)))
// Make the HTTP request
req, err := http.NewRequest("PUT",