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) }