From 762cc19c14373c34591bd5ad84582c28ea3fbd0e Mon Sep 17 00:00:00 2001 From: mr Date: Fri, 23 Aug 2024 22:17:03 +0200 Subject: [PATCH] simplify call to peer --- tools/api.go | 2 +- tools/remote_caller.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/api.go b/tools/api.go index e436f11..40a4136 100644 --- a/tools/api.go +++ b/tools/api.go @@ -66,7 +66,7 @@ func (a *API) CheckRemotePeer(url string) (State, map[string]int) { // Check if the database is up caller := NewHTTPCaller(map[string]map[METHOD]string{}) var resp APIStatusResponse - b, err := caller.CallPost(url, "/status", []string{}) + b, err := caller.CallPost(url, "/status", map[string]interface{}{}) fmt.Println("CheckRemotePeer", b, url, err) if err != nil { return DEAD, map[string]int{} diff --git a/tools/remote_caller.go b/tools/remote_caller.go index a72c4c9..1d4467d 100644 --- a/tools/remote_caller.go +++ b/tools/remote_caller.go @@ -63,7 +63,7 @@ func (caller *HTTPCaller) CallDelete(url string, subpath string) ([]byte, error) return io.ReadAll(resp.Body) } -func (caller *HTTPCaller) CallPost(url string, subpath string, body interface{}) ([]byte, error) { +func (caller *HTTPCaller) CallPost(url string, subpath string, body map[string]interface{}) ([]byte, error) { postBody, _ := json.Marshal(body) responseBody := bytes.NewBuffer(postBody) resp, err := http.Post(url+subpath, "application/json", responseBody)