modified the way HTTPCaller store last resposne

This commit is contained in:
pb 2025-03-12 12:09:55 +01:00
parent b81c60a3ce
commit 037ae74782

View File

@ -113,7 +113,10 @@ func (caller *HTTPCaller) CallPost(url string, subpath string, body interface{},
return nil, err
}
defer resp.Body.Close()
caller.LastResults = resp
err = caller.StoreResp(resp)
if err != nil {
return nil, err
}
return io.ReadAll(resp.Body)
}
@ -132,7 +135,6 @@ func (caller *HTTPCaller) CallPut(url string, subpath string, body map[string]in
return nil, err
}
defer resp.Body.Close()
caller.LastResults = resp
return io.ReadAll(resp.Body)
}
@ -158,7 +160,6 @@ func (caller *HTTPCaller) CallRaw(method string, url string, subpath string,
return nil, err
}
caller.LastResults = resp
return resp, nil
}
@ -190,6 +191,6 @@ func (caller *HTTPCaller) StoreResp(resp *http.Response) error {
}
caller.LastResults["body"] = data
return nil
}