method
This commit is contained in:
parent
cd902c6688
commit
cc8fc2df21
@ -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
|
// 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)
|
postBody, _ := json.Marshal(body)
|
||||||
responseBody := bytes.NewBuffer(postBody)
|
responseBody := bytes.NewBuffer(postBody)
|
||||||
req, err := http.NewRequest(method, url+subpath, responseBody)
|
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 {
|
if fakeTLSTermination {
|
||||||
req.Header.Add("X-Forwarded-Proto", "https")
|
req.Header.Add("X-Forwarded-Proto", "https")
|
||||||
}
|
}
|
||||||
|
for _, c := range cookies {
|
||||||
|
req.AddCookie(c)
|
||||||
|
}
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
return client.Do(req)
|
return client.Do(req)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user