light modification

This commit is contained in:
mr
2025-01-23 08:35:28 +01:00
parent 0e798dac50
commit 99693d8ec0
10 changed files with 21 additions and 33 deletions

View File

@@ -3,7 +3,6 @@ package tools
import (
"encoding/json"
"errors"
"fmt"
"strings"
"cloud.o-forge.io/core/oc-lib/config"
@@ -150,7 +149,6 @@ func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error)
continue
}
json.Unmarshal(b, &resp)
fmt.Println(string(b))
if resp.Data == nil { //
state = REDUCED_SERVICE // If the response is empty, return reduced service
continue

View File

@@ -3,7 +3,6 @@ package tools
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
@@ -94,17 +93,14 @@ func (caller *HTTPCaller) CallDelete(url string, subpath string) ([]byte, error)
func (caller *HTTPCaller) CallPost(url string, subpath string, body interface{}, types ...string) ([]byte, error) {
postBody, err := json.Marshal(body)
if err != nil {
fmt.Println(postBody)
return nil, err
}
responseBody := bytes.NewBuffer(postBody)
fmt.Println(responseBody)
contentType := "application/json"
if len(types) > 0 {
contentType = types[0]
}
resp, err := http.Post(url+subpath, contentType, responseBody)
fmt.Println(resp, err)
if err != nil || resp == nil || resp.Body == nil {
return nil, err
}