debil-finder/checks/checks.go
2021-10-08 15:20:19 +02:00

26 lines
415 B
Go

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
}