diff --git a/cmd/cli.go b/cmd/cli.go index 2f443be1..d39d3ad4 100644 --- a/cmd/cli.go +++ b/cmd/cli.go @@ -241,7 +241,7 @@ func HelpEcho() { func checkGithubUpdates() (githubResponse, error) { var gitResp githubResponse url := "https://api.github.com/repos/hunterlong/statping/releases/latest" - contents, _, err := utils.HttpRequest(url, "GET", nil, nil, nil, time.Duration(10*time.Second)) + contents, _, err := utils.HttpRequest(url, "GET", nil, nil, nil, time.Duration(10*time.Second), true) if err != nil { return githubResponse{}, err } diff --git a/core/checker.go b/core/checker.go index 53714630..6eff907e 100644 --- a/core/checker.go +++ b/core/checker.go @@ -211,9 +211,9 @@ func (s *Service) checkHttp(record bool) *Service { } if s.Method == "POST" { - content, res, err = utils.HttpRequest(s.Domain, s.Method, "application/json", headers, bytes.NewBuffer([]byte(s.PostData.String)), timeout) + content, res, err = utils.HttpRequest(s.Domain, s.Method, "application/json", headers, bytes.NewBuffer([]byte(s.PostData.String)), timeout, s.VerifySSL.Bool) } else { - content, res, err = utils.HttpRequest(s.Domain, s.Method, nil, headers, nil, timeout) + content, res, err = utils.HttpRequest(s.Domain, s.Method, nil, headers, nil, timeout, s.VerifySSL.Bool) } if err != nil { if record { diff --git a/notifiers/discord.go b/notifiers/discord.go index 2c656149..82cb1c70 100644 --- a/notifiers/discord.go +++ b/notifiers/discord.go @@ -59,7 +59,7 @@ func init() { // Send will send a HTTP Post to the discord API. It accepts type: []byte func (u *discord) Send(msg interface{}) error { message := msg.(string) - _, _, err := utils.HttpRequest(discorder.GetValue("host"), "POST", "application/json", nil, strings.NewReader(message), time.Duration(10*time.Second)) + _, _, err := utils.HttpRequest(discorder.GetValue("host"), "POST", "application/json", nil, strings.NewReader(message), time.Duration(10*time.Second), true) return err } @@ -93,7 +93,7 @@ func (u *discord) OnSave() error { func (u *discord) OnTest() error { outError := errors.New("Incorrect discord URL, please confirm URL is correct") message := `{"content": "Testing the discord notifier"}` - contents, _, err := utils.HttpRequest(discorder.Host, "POST", "application/json", nil, bytes.NewBuffer([]byte(message)), time.Duration(10*time.Second)) + contents, _, err := utils.HttpRequest(discorder.Host, "POST", "application/json", nil, bytes.NewBuffer([]byte(message)), time.Duration(10*time.Second), true) if string(contents) == "" { return nil } diff --git a/notifiers/line_notify.go b/notifiers/line_notify.go index 454d07b2..4e5cd3f8 100644 --- a/notifiers/line_notify.go +++ b/notifiers/line_notify.go @@ -62,7 +62,7 @@ func (u *lineNotifier) Send(msg interface{}) error { v := url.Values{} v.Set("message", message) headers := []string{fmt.Sprintf("Authorization=Bearer %v", u.ApiSecret)} - _, _, err := utils.HttpRequest("https://notify-api.line.me/api/notify", "POST", "application/x-www-form-urlencoded", headers, strings.NewReader(v.Encode()), time.Duration(10*time.Second)) + _, _, err := utils.HttpRequest("https://notify-api.line.me/api/notify", "POST", "application/x-www-form-urlencoded", headers, strings.NewReader(v.Encode()), time.Duration(10*time.Second), true) return err } diff --git a/notifiers/mobile.go b/notifiers/mobile.go index 9978a78f..3cceebf1 100644 --- a/notifiers/mobile.go +++ b/notifiers/mobile.go @@ -176,7 +176,7 @@ func pushRequest(msg *pushArray) ([]byte, error) { return nil, err } url := "https://push.statping.com/api/push" - body, _, err = utils.HttpRequest(url, "POST", "application/json", nil, bytes.NewBuffer(body), time.Duration(20*time.Second)) + body, _, err = utils.HttpRequest(url, "POST", "application/json", nil, bytes.NewBuffer(body), time.Duration(20*time.Second), true) return body, err } diff --git a/notifiers/slack.go b/notifiers/slack.go index 14de3afa..7c435ef2 100644 --- a/notifiers/slack.go +++ b/notifiers/slack.go @@ -79,12 +79,13 @@ type slackMessage struct { Service *types.Service Template string Time int64 + Issue string } // Send will send a HTTP Post to the slack webhooker API. It accepts type: string func (u *slack) Send(msg interface{}) error { message := msg.(string) - _, _, err := utils.HttpRequest(u.Host, "POST", "application/json", nil, strings.NewReader(message), time.Duration(10*time.Second)) + _, _, err := utils.HttpRequest(u.Host, "POST", "application/json", nil, strings.NewReader(message), time.Duration(10*time.Second), true) return err } @@ -93,7 +94,7 @@ func (u *slack) Select() *notifier.Notification { } func (u *slack) OnTest() error { - contents, _, err := utils.HttpRequest(u.Host, "POST", "application/json", nil, bytes.NewBuffer([]byte(`{"text":"testing message"}`)), time.Duration(10*time.Second)) + contents, _, err := utils.HttpRequest(u.Host, "POST", "application/json", nil, bytes.NewBuffer([]byte(`{"text":"testing message"}`)), time.Duration(10*time.Second), true) if string(contents) != "ok" { return errors.New("The slack response was incorrect, check the URL") } diff --git a/notifiers/telegram.go b/notifiers/telegram.go index 842bbc72..000b3292 100644 --- a/notifiers/telegram.go +++ b/notifiers/telegram.go @@ -78,7 +78,7 @@ func (u *telegram) Send(msg interface{}) error { v.Set("text", message) rb := *strings.NewReader(v.Encode()) - contents, _, err := utils.HttpRequest(apiEndpoint, "GET", "application/x-www-form-urlencoded", nil, &rb, time.Duration(10*time.Second)) + contents, _, err := utils.HttpRequest(apiEndpoint, "GET", "application/x-www-form-urlencoded", nil, &rb, time.Duration(10*time.Second), true) success, _ := telegramSuccess(contents) if !success { diff --git a/notifiers/twilio.go b/notifiers/twilio.go index 61b4dcf4..6dcf9fbd 100644 --- a/notifiers/twilio.go +++ b/notifiers/twilio.go @@ -89,7 +89,7 @@ func (u *twilio) Send(msg interface{}) error { v.Set("Body", message) rb := *strings.NewReader(v.Encode()) - contents, _, err := utils.HttpRequest(twilioUrl, "POST", "application/x-www-form-urlencoded", nil, &rb, time.Duration(10*time.Second)) + contents, _, err := utils.HttpRequest(twilioUrl, "POST", "application/x-www-form-urlencoded", nil, &rb, time.Duration(10*time.Second), true) success, _ := twilioSuccess(contents) if !success { errorOut := twilioError(contents) diff --git a/source/tmpl/form_service.gohtml b/source/tmpl/form_service.gohtml index 053477f0..f9ee9376 100644 --- a/source/tmpl/form_service.gohtml +++ b/source/tmpl/form_service.gohtml @@ -108,6 +108,16 @@ You can also drag and drop services to reorder on the Services tab. +