debil-finder/checks/checks.go

26 lines
415 B
Go
Raw Permalink Normal View History

2021-10-08 13:20:19 +00:00
package checks
import (
"fmt"
"net/http"
)
type Checks struct {
Message func(string)
}
func (c *Checks) get(url string) (*http.Response, error) {
res, err := http.Get(url)
if err != nil {
//log.Println(domain + " error: " + err.Error())
return nil, err
}
if res.StatusCode != 200 {
//log.Println(domain + " status: " + res.Status)
return nil, fmt.Errorf("bad status code")
}
return res, nil
}