This commit is contained in:
mr 2024-10-23 10:51:15 +02:00
parent 84deb17e37
commit cd902c6688

View File

@ -121,7 +121,7 @@ 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) (*http.Response, error) { func (caller *HTTPCaller) CallRaw(method string, url string, subpath string, body map[string]interface{}, content_type string, fakeTLSTermination bool) (*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)
@ -129,6 +129,9 @@ func (caller *HTTPCaller) CallRaw(method string, url string, subpath string, bod
return nil, err return nil, err
} }
req.Header.Set("Content-Type", content_type) req.Header.Set("Content-Type", content_type)
if fakeTLSTermination {
req.Header.Add("X-Forwarded-Proto", "https")
}
client := &http.Client{} client := &http.Client{}
return client.Do(req) return client.Do(req)
} }