Skip to content

Commit

Permalink
Allow HTTPS endpoints in client
Browse files Browse the repository at this point in the history
  • Loading branch information
Anders Chen committed Oct 25, 2021
1 parent 5a3ea8a commit 6178848
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"strings"
)
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit 6178848

Please sign in to comment.