Skip to content

Commit

Permalink
fix(NewClient): support https:// URLs
Browse files Browse the repository at this point in the history
We don't hardcode any specific ports, but assume `http://`
(backward-compatible behavior)  unless `https://` is passed (then we
keep it as-is).
  • Loading branch information
lidel committed Jan 10, 2025
1 parent 2432d3e commit 5b1af49
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ func ClientWithRawAbsPath(rawAbsPath bool) ClientOpt {

// NewClient constructs a new HTTP-backed command executor.
func NewClient(address string, opts ...ClientOpt) cmds.Executor {
if !strings.HasPrefix(address, "http://") {
// default to HTTP to keep backward-compatible behavior, but keep https:// if passed
if !strings.HasPrefix(address, "http:") && !strings.HasPrefix(address, "https:") {
address = "http://" + address
}

Expand Down

0 comments on commit 5b1af49

Please sign in to comment.