From 8819b69d2da0786a7dd941e27e0f03ae9a0cb9a5 Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Mon, 16 Mar 2026 23:32:02 +0100 Subject: [PATCH] Support http:// hosts in CLI client for local development The CLI client was hardcoding https:// scheme, which prevents local dev with http://localhost. Add support for bare hostnames (auto-prepend https) while preserving http:// and https:// prefixes when explicitly provided. Signed-off-by: Bryan Frimin --- pkg/cli/api/client.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/cli/api/client.go b/pkg/cli/api/client.go index c0a115c2b..05a645b68 100644 --- a/pkg/cli/api/client.go +++ b/pkg/cli/api/client.go @@ -98,7 +98,12 @@ func (c *Client) DoRaw( return nil, fmt.Errorf("cannot marshal GraphQL request: %w", err) } - url := fmt.Sprintf("https://%s%s", c.host, c.endpoint) + host := c.host + if !strings.HasPrefix(host, "http://") && !strings.HasPrefix(host, "https://") { + host = "https://" + host + } + + url := fmt.Sprintf("%s%s", host, c.endpoint) req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(body)) if err != nil { return nil, fmt.Errorf("cannot create HTTP request: %w", err)