mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
Added missing error check to MakeRequest function
This commit is contained in:
parent
da648f98b8
commit
ac1dc023c0
1 changed files with 4 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue