casual http debug

This commit is contained in:
mr
2024-08-22 10:19:14 +02:00
parent fb80e05d6a
commit 4abf59a10d
2 changed files with 8 additions and 1 deletions

View File

@@ -34,7 +34,8 @@ func (s State) String() string {
"some things boils in here, i'm probably a teapot", "dead"}[s]
}
type API struct{}
type API struct {
}
func (a *API) GetState() (State, int, error) {
// Check if the database is up
@@ -78,6 +79,9 @@ func (a *API) CheckRemoteAPIs(urls []string) (State, int, error) {
return REDUCED_SERVICE, 200, err
}
json.Unmarshal(b, &resp)
if resp.Data == nil {
return DEAD, 200, errors.New(url + " -> is DEAD")
}
if resp.Data.Code != 0 {
return REDUCED_SERVICE, 200, errors.New(url + " -> " + resp.Error)
}