From 6178848a134933244cddc1c2f36a0ec562256a18 Mon Sep 17 00:00:00 2001 From: Anders Chen Date: Sun, 24 Oct 2021 19:52:42 -1000 Subject: [PATCH] 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}