yanic/contrib/respondd-crashed/helper.go
Martin/Geno 2f6e22f8cc
[TASK] add respondd-crashed
a tool to find wrong offline detected nodes.
by pinging the nodes which does not answer by respondd
2019-01-20 03:20:12 +01:00

25 lines
346 B
Go

package main
import (
"encoding/json"
"net/http"
"time"
)
func JSONRequest(url string, value interface{}) error {
var netClient = &http.Client{
Timeout: time.Second * 20,
}
resp, err := netClient.Get(url)
if err != nil {
return err
}
err = json.NewDecoder(resp.Body).Decode(&value)
if err != nil {
return err
}
return nil
}