fix: api breaking change

This commit is contained in:
martabal 2023-11-08 15:50:40 +01:00
parent 657181a728
commit e78aad9501
No known key found for this signature in database
GPG key ID: C00196E3148A52BD

View file

@ -97,7 +97,7 @@ func ServerVersion(r *prometheus.Registry) {
func ServerInfo(c chan func() (*models.StructServerInfo, error)) { func ServerInfo(c chan func() (*models.StructServerInfo, error)) {
defer wg.Done() defer wg.Done()
resp, err := Apirequest("/api/server-info/stats", "GET") resp, err := Apirequest("/api/server-info/statistics", "GET")
if err == nil { if err == nil {
if models.GetPromptError() == true { if models.GetPromptError() == true {
@ -144,6 +144,12 @@ func Apirequest(uri string, method string) (*http.Response, error) {
models.SetPromptError(false) models.SetPromptError(false)
} }
return resp, nil return resp, nil
case http.StatusNotFound:
err := fmt.Errorf("%d", resp.StatusCode)
log.Fatal("Error code ", resp.StatusCode, " for ", models.Getbaseurl()+uri)
return resp, err
case http.StatusUnauthorized, http.StatusForbidden: case http.StatusUnauthorized, http.StatusForbidden:
err := fmt.Errorf("%d", resp.StatusCode) err := fmt.Errorf("%d", resp.StatusCode)