method
This commit is contained in:
parent
55a25aba83
commit
158d3aacc8
@ -119,3 +119,16 @@ func (caller *HTTPCaller) CallPut(url string, subpath string, body map[string]in
|
||||
defer resp.Body.Close()
|
||||
return io.ReadAll(resp.Body)
|
||||
}
|
||||
|
||||
// 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) {
|
||||
postBody, _ := json.Marshal(body)
|
||||
responseBody := bytes.NewBuffer(postBody)
|
||||
req, err := http.NewRequest(method, url+subpath, responseBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Set("Content-Type", content_type)
|
||||
client := &http.Client{}
|
||||
return client.Do(req)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user