modified HTTP caller to have a DeepCopy() method in order to parallelize calls without race conditions
This commit is contained in:
@@ -63,6 +63,16 @@ func NewHTTPCaller(urls map[DataType]map[METHOD]string) *HTTPCaller {
|
||||
}
|
||||
}
|
||||
|
||||
// Creates a copy of the current caller, in order to have parallelized executions without race condition
|
||||
func (c* HTTPCaller) DeepCopy(dst HTTPCaller) error {
|
||||
bytes, err := json.Marshal(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return json.Unmarshal(bytes, &dst)
|
||||
}
|
||||
|
||||
// CallGet calls the GET method on the HTTP server
|
||||
func (caller *HTTPCaller) CallGet(url string, subpath string, types ...string) ([]byte, error) {
|
||||
req, err := http.NewRequest(http.MethodGet, url+subpath, bytes.NewBuffer([]byte("")))
|
||||
|
||||
Reference in New Issue
Block a user