From bf6bfc39a882637f2efc4e1c593352dfa5a77b51 Mon Sep 17 00:00:00 2001 From: Rostislav <43965646+lyro41@users.noreply.github.com> Date: Sun, 17 Mar 2024 03:54:43 +0300 Subject: [PATCH] check for err before request response field access (#169) Co-authored-by: Rostislav Lyupa <> --- client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.go b/client.go index b4109e5..f0e6851 100644 --- a/client.go +++ b/client.go @@ -114,10 +114,10 @@ func (c *Client) Request(req *http.Request, dst interface{}) (err error) { c.debugf("request: %v", req) resp, err := c.httpClient.Do(req) c.debugf("response: %v", resp) - c.debugf("response status code: %v", resp.StatusCode) if err != nil { return err } + c.debugf("response status code: %v", resp.StatusCode) defer func() { cerr := resp.Body.Close() if err == nil && cerr != nil {