From 39fb45d8dabe2bf067e7ad72d0036b4fa6b9715e Mon Sep 17 00:00:00 2001 From: Andrew Stuart Date: Tue, 31 Jan 2017 08:11:54 -0700 Subject: [PATCH 1/2] bugfix (cli) Update the URL check to work with https --- fission/common.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fission/common.go b/fission/common.go index d25d2950..a4926fca 100644 --- a/fission/common.go +++ b/fission/common.go @@ -35,7 +35,12 @@ func getClient(serverUrl string) *client.Client { fatal("Need --server or FISSION_URL set to your fission server.") } - serverUrl = "http://" + strings.TrimPrefix(serverUrl, "http://") + isHttps := strings.Index(serverUrl, "https://") == 0 + isHttp := strings.Index(serverUrl, "http://") == 0 + + if !isHttp && !isHttps { + serverUrl = "http://" + serverUrl + } return client.MakeClient(serverUrl) } From 1cc1fac151f99f23c2786a16c7e1ff56caa276ac Mon Sep 17 00:00:00 2001 From: Andrew Stuart Date: Tue, 31 Jan 2017 08:25:57 -0700 Subject: [PATCH 2/2] Satisfy golint, clarify logic --- fission/common.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fission/common.go b/fission/common.go index a4926fca..1e56677d 100644 --- a/fission/common.go +++ b/fission/common.go @@ -35,10 +35,10 @@ func getClient(serverUrl string) *client.Client { fatal("Need --server or FISSION_URL set to your fission server.") } - isHttps := strings.Index(serverUrl, "https://") == 0 - isHttp := strings.Index(serverUrl, "http://") == 0 + isHTTPS := strings.Index(serverUrl, "https://") == 0 + isHTTP := strings.Index(serverUrl, "http://") == 0 - if !isHttp && !isHttps { + if !(isHTTP || isHTTPS) { serverUrl = "http://" + serverUrl }