From ac1dc023c01069ea3ef1fbe3d5f0425a4f3b8961 Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Thu, 5 Oct 2023 13:52:07 -0600 Subject: [PATCH] Added missing error check to `MakeRequest` function --- internal/util/util.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/util/util.go b/internal/util/util.go index 0efa1b5..990bda9 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -19,7 +19,10 @@ func PathExists(path string) (bool, error) { func MakeRequest(url string, httpMethod string, body []byte, headers map[string]string) (*http.Response, []byte, error) { http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} - req, _ := http.NewRequest(httpMethod, url, bytes.NewBuffer(body)) + req, err := http.NewRequest(httpMethod, url, bytes.NewBuffer(body)) + if err != nil { + return nil, nil, fmt.Errorf("could not create new HTTP request: %v", err) + } req.Header.Add("User-Agent", "magellan") for k, v := range headers { req.Header.Add(k, v)