modified the way HTTPCaller store last resposne
This commit is contained in:
parent
b81c60a3ce
commit
037ae74782
@ -113,7 +113,10 @@ func (caller *HTTPCaller) CallPost(url string, subpath string, body interface{},
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
caller.LastResults = resp
|
err = caller.StoreResp(resp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
return io.ReadAll(resp.Body)
|
return io.ReadAll(resp.Body)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +135,6 @@ func (caller *HTTPCaller) CallPut(url string, subpath string, body map[string]in
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
caller.LastResults = resp
|
|
||||||
return io.ReadAll(resp.Body)
|
return io.ReadAll(resp.Body)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +160,6 @@ func (caller *HTTPCaller) CallRaw(method string, url string, subpath string,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
caller.LastResults = resp
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,6 +191,6 @@ func (caller *HTTPCaller) StoreResp(resp *http.Response) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
caller.LastResults["body"] = data
|
caller.LastResults["body"] = data
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user