From cc8fc2df2161a19c020d631bfa563d936cf499d4 Mon Sep 17 00:00:00 2001 From: mr Date: Wed, 23 Oct 2024 11:22:34 +0200 Subject: [PATCH] method --- tools/remote_caller.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/remote_caller.go b/tools/remote_caller.go index a6bd595..492ddba 100644 --- a/tools/remote_caller.go +++ b/tools/remote_caller.go @@ -121,7 +121,8 @@ func (caller *HTTPCaller) CallPut(url string, subpath string, body map[string]in } // 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, fakeTLSTermination bool) (*http.Response, error) { +func (caller *HTTPCaller) CallRaw(method string, url string, subpath string, + body map[string]interface{}, content_type string, fakeTLSTermination bool, cookies ...*http.Cookie) (*http.Response, error) { postBody, _ := json.Marshal(body) responseBody := bytes.NewBuffer(postBody) req, err := http.NewRequest(method, url+subpath, responseBody) @@ -132,6 +133,9 @@ func (caller *HTTPCaller) CallRaw(method string, url string, subpath string, bod if fakeTLSTermination { req.Header.Add("X-Forwarded-Proto", "https") } + for _, c := range cookies { + req.AddCookie(c) + } client := &http.Client{} return client.Do(req) }