File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
22
22
"crypto/x509"
23
23
"fmt"
24
24
"io"
25
+ "net"
25
26
"net/http"
26
27
"os"
27
28
"path"
@@ -382,8 +383,13 @@ users:
382
383
if want , got := tt .wantSecureCode != nil , secureInfo != nil ; want != got {
383
384
t .Errorf ("SecureServing enabled: expected=%v got=%v" , want , got )
384
385
} else if want {
385
- url := fmt .Sprintf ("https://%s%s" , secureInfo .Listener .Addr ().String (), tt .path )
386
- url = strings .ReplaceAll (url , "[::]" , "127.0.0.1" ) // switch to IPv4 because the self-signed cert does not support [::]
386
+ // only interested on the port, because we are using always localhost
387
+ _ , port , err := net .SplitHostPort (secureInfo .Listener .Addr ().String ())
388
+ if err != nil {
389
+ t .Fatalf ("could not get host and port from %s : %v" , secureInfo .Listener .Addr ().String (), err )
390
+ }
391
+ // use IPv4 because the self-signed cert does not support [::]
392
+ url := fmt .Sprintf ("https://127.0.0.1:%s%s" , port , tt .path )
387
393
388
394
// read self-signed server cert disk
389
395
pool := x509 .NewCertPool ()
You can’t perform that action at this time.
0 commit comments