From 6178848a134933244cddc1c2f36a0ec562256a18 Mon Sep 17 00:00:00 2001 From: Anders Chen Date: Sun, 24 Oct 2021 19:52:42 -1000 Subject: [PATCH 1/2] Allow HTTPS endpoints in client --- client/client.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/client/client.go b/client/client.go index 4b97961f..45d959a7 100644 --- a/client/client.go +++ b/client/client.go @@ -10,7 +10,6 @@ import ( "fmt" "io" "io/ioutil" - "log" "net/http" "strings" ) @@ -48,9 +47,7 @@ type Proxy struct { // with Toxiproxy. Endpoint is the address to the proxy (e.g. localhost:8474 if // not overridden). func NewClient(endpoint string) *Client { - if strings.HasPrefix(endpoint, "https://") { - log.Fatal("the toxiproxy client does not support https") - } else if !strings.HasPrefix(endpoint, "http://") { + if !strings.HasPrefix(endpoint, "https://") && !strings.HasPrefix(endpoint, "http://") { endpoint = "http://" + endpoint } return &Client{endpoint: endpoint} From 729ed0e9677071497053e0506469702b10d3d5bf Mon Sep 17 00:00:00 2001 From: Anders Chen Date: Mon, 25 Oct 2021 02:41:16 -1000 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6269fa22..b452738a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * Store all the executable `main` packages in `cmd` folder. (#335, @miry) * Extract common test helpers to own files. (#336, @miry) +* Client: Allow HTTPS endpoints. (#338, @chen-anders) # [2.2.0]