GetBody issues a GET to the specified URL, reads and closes response body and returns response, response body bytes and error if any.
(url string)
| 164 | // GetBody issues a GET to the specified URL, reads and closes response body and |
| 165 | // returns response, response body bytes and error if any. |
| 166 | func (c *TestClient) GetBody(url string) (rsp *http.Response, body []byte, err error) { |
| 167 | rsp, err = c.Get(url) |
| 168 | if err != nil { |
| 169 | return |
| 170 | } |
| 171 | defer rsp.Body.Close() |
| 172 | |
| 173 | body, err = io.ReadAll(rsp.Body) |
| 174 | return |
| 175 | } |