From ca9c1b5f7c4c34317105898f25c492b9508a007f Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Wed, 26 Feb 2020 14:16:14 -0700 Subject: [PATCH] allow auth to have normal separater --- main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) mode change 100644 => 100755 main.go diff --git a/main.go b/main.go old mode 100644 new mode 100755 index b2b2510..4bb7ba9 --- a/main.go +++ b/main.go @@ -35,7 +35,7 @@ func Main() error { var bodyRepeat int var path, host, method, body, headers, brandID, userID, issuer, basicAuth, claims string var ca, cert, key, secret string - var needJWT, verbose, jsonPP bool + var needJWT, verbose, jsonPP, quiet bool var timeout, lag time.Duration flag.StringVar(&method, "method", "get", "method for request") flag.StringVar(&path, "path", "fieldsetdefinitions/v1/index/surveys/SV_031sm3MMOPSa8Tz/fieldsets?assumeHasPermission=true", "path for request") @@ -50,6 +50,7 @@ func Main() error { flag.BoolVar(&needJWT, "jwt", true, "need jwt boolean") flag.BoolVar(&jsonPP, "jpp", true, "try json pretty print") flag.BoolVar(&verbose, "v", false, "is verbose") + flag.BoolVar(&quiet, "q", false, "is quiet") flag.DurationVar(&timeout, "t", time.Second*10, "request timeout") flag.DurationVar(&lag, "lag", time.Second*0, "writing request lag after connecting") flag.StringVar(&ca, "ca", "", "ca for server") @@ -59,6 +60,11 @@ func Main() error { flag.StringVar(&claims, "claims", "", "extra claims as k=v,k=v") flag.Parse() + if quiet { + f, _ := ioutil.TempFile(os.TempDir(), "*") + os.Stderr = f + } + if !strings.HasPrefix(host, "http") { host = "http://" + host } @@ -92,6 +98,9 @@ func Main() error { } if basicAuth != "" { splits := strings.Split(basicAuth, ",") + if len(splits) == 1 { + splits = strings.Split(basicAuth, ":") + } req.SetBasicAuth(splits[0], splits[1]) }