diff --git a/tools/remote_caller.go b/tools/remote_caller.go index bf1ce37..b6aac28 100644 --- a/tools/remote_caller.go +++ b/tools/remote_caller.go @@ -119,3 +119,16 @@ func (caller *HTTPCaller) CallPut(url string, subpath string, body map[string]in defer resp.Body.Close() return io.ReadAll(resp.Body) } + +// CallRaw calls the Raw method on the HTTP server +func (caller *HTTPCaller) CallRaw(method string, url string, subpath string, body map[string]interface{}, content_type string) (*http.Response, error) { + postBody, _ := json.Marshal(body) + responseBody := bytes.NewBuffer(postBody) + req, err := http.NewRequest(method, url+subpath, responseBody) + if err != nil { + return nil, err + } + req.Header.Set("Content-Type", content_type) + client := &http.Client{} + return client.Do(req) +}