From d66f579eb4ac9b977da6344d12e1e193c28ba7e3 Mon Sep 17 00:00:00 2001 From: Ahmed Yusuf Date: Thu, 12 Mar 2020 22:10:00 +0300 Subject: [PATCH 1/2] Accepting basic auth headers --- http.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/http.go b/http.go index 27c8b3a..4bf2214 100644 --- a/http.go +++ b/http.go @@ -34,6 +34,7 @@ type HTTPMonitor struct { Method string ExpectedStatusCode int `mapstructure:"expected_status_code"` Headers map[string]string + Auth map[string]string // compiled to Regexp ExpectedBody string `mapstructure:"expected_body"` @@ -47,6 +48,10 @@ func (monitor *HTTPMonitor) test() bool { req.Header.Add(k, v) } + if monitor.Auth != nil { + req.SetBasicAuth(monitor.Auth["username"], monitor.Auth["password"]) + } + transport := http.DefaultTransport.(*http.Transport) transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: monitor.Strict == false} client := &http.Client{ From 10adebf83159a6ec9cb78577a0ef4209d522b502 Mon Sep 17 00:00:00 2001 From: Ahmed Yusuf Date: Thu, 12 Mar 2020 22:18:02 +0300 Subject: [PATCH 2/2] cli change to fetch from our repo --- cli/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/main.go b/cli/main.go index 2ac47ce..2552752 100644 --- a/cli/main.go +++ b/cli/main.go @@ -12,9 +12,9 @@ import ( "sync" "github.com/Sirupsen/logrus" - cachet "github.com/castawaylabs/cachet-monitor" docopt "github.com/docopt/docopt-go" "github.com/mitchellh/mapstructure" + cachet "github.com/viitech/cachet-monitor" "gopkg.in/yaml.v2" )