From e45fefe883697e789745458b7e02e89364f9b31c Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 21 Oct 2024 11:39:52 +0200 Subject: [PATCH] get with custom types --- tools/remote_caller.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/remote_caller.go b/tools/remote_caller.go index 4d05476..8480f62 100644 --- a/tools/remote_caller.go +++ b/tools/remote_caller.go @@ -53,8 +53,16 @@ func NewHTTPCaller(urls map[DataType]map[METHOD]string) *HTTPCaller { } // CallGet calls the GET method on the HTTP server -func (caller *HTTPCaller) CallGet(url string, subpath string) ([]byte, error) { - resp, err := http.Get(url + subpath) +func (caller *HTTPCaller) CallGet(url string, subpath string, types ...string) ([]byte, error) { + req, err := http.NewRequest(http.MethodGet, url+subpath, bytes.NewBuffer([]byte(""))) + if err != nil { + return nil, err + } + for _, t := range types { + req.Header.Set("Content-Type", t) + } + client := &http.Client{} + resp, err := client.Do(req) if err != nil { return nil, err }