From 24c95871c559e4d0a284f4c245d6e7afaeb5b9a7 Mon Sep 17 00:00:00 2001 From: Ivan Schwarz Date: Fri, 14 Jun 2019 15:41:14 +0200 Subject: Update client dependency --- vendor/github.com/DreamItGetIT/statuscake/tests.go | 29 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'vendor/github.com/DreamItGetIT/statuscake/tests.go') diff --git a/vendor/github.com/DreamItGetIT/statuscake/tests.go b/vendor/github.com/DreamItGetIT/statuscake/tests.go index c6e6dd2..2a2383d 100644 --- a/vendor/github.com/DreamItGetIT/statuscake/tests.go +++ b/vendor/github.com/DreamItGetIT/statuscake/tests.go @@ -42,7 +42,7 @@ type Test struct { // Current status at last test Status string `json:"Status"` - // 7 Day Uptime + // 1 Day Uptime Uptime float64 `json:"Uptime"` // Any test locations seperated by a comma (using the Node Location IDs) @@ -75,7 +75,7 @@ type Test struct { Branding int `json:"Branding" querystring:"Branding"` // Used internally by the statuscake API - WebsiteHost string `json:"WebsiteHost"` + WebsiteHost string `json:"WebsiteHost" querystring:"WebsiteHost"` // Enable virus checking or not. 1 to enable Virus int `json:"Virus" querystring:"Virus"` @@ -110,6 +110,9 @@ type Test struct { // Use to specify the expected Final URL in the testing process FinalEndpoint string `json:"FinalEndpoint" querystring:"FinalEndpoint"` + // Use to enable SSL validation + EnableSSLAlert bool `json:"EnableSSLAlert" querystring:"EnableSSLAlert"` + // Use to specify whether redirects should be followed FollowRedirect bool `json:"FollowRedirect" querystring:"FollowRedirect"` } @@ -166,9 +169,11 @@ func (t *Test) Validate() error { e["FinalEndpoint"] = "must be a Valid URL" } - var jsonVerifiable map[string]interface{} - if json.Unmarshal([]byte(t.CustomHeader), &jsonVerifiable) != nil { - e["CustomHeader"] = "must be provided as json string" + if t.CustomHeader != "" { + var jsonVerifiable map[string]interface{} + if json.Unmarshal([]byte(t.CustomHeader), &jsonVerifiable) != nil { + e["CustomHeader"] = "must be provided as json string" + } } if len(e) > 0 { @@ -244,6 +249,7 @@ func valueToQueryStringValue(v reflect.Value) string { // Tests is a client that implements the `Tests` API. type Tests interface { All() ([]*Test, error) + AllWithFilter(url.Values) ([]*Test, error) Detail(int) (*Test, error) Update(*Test) (*Test, error) Delete(TestID int) error @@ -272,6 +278,19 @@ func (tt *tests) All() ([]*Test, error) { return tests, err } +func (tt *tests) AllWithFilter(filterOptions url.Values) ([]*Test, error) { + resp, err := tt.client.get("/Tests", filterOptions) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + var tests []*Test + err = json.NewDecoder(resp.Body).Decode(&tests) + + return tests, err +} + func (tt *tests) Update(t *Test) (*Test, error) { resp, err := tt.client.put("/Tests/Update", t.ToURLValues()) if err != nil { -- cgit v1.2.3