Skip to content

Commit

Permalink
command/ready: support :<port> syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatczuk committed Mar 27, 2024
1 parent 0acce89 commit 1b677b0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion command/ready/ready.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package ready

import (
"fmt"
"net"
"net/http"
"net/http/httputil"

Expand All @@ -19,7 +20,15 @@ type command struct {
}

func (c *command) runE(cmd *cobra.Command, _ []string) error {
resp, err := http.Get("http://" + c.apiAddr + "/readyz") //nolint:noctx // net/http.Get must not be called
host, port, err := net.SplitHostPort(c.apiAddr)
if err != nil {
return err
}
if host == "" {
host = "localhost"
}

resp, err := http.Get("http://" + net.JoinHostPort(host, port) + "/readyz") //nolint:noctx // net/http.Get must not be called
if err != nil {
return err
}
Expand Down

0 comments on commit 1b677b0

Please sign in to comment.