package cachet import ( "bytes" "io/ioutil" "net/http" ) func makeRequest(requestType string, url string, reqBody []byte) (*http.Response, []byte, error) { req, err := http.NewRequest(requestType, Config.APIUrl+url, bytes.NewBuffer(reqBody)) req.Header.Set("Content-Type", "application/json") req.Header.Set("X-Cachet-Token", Config.APIToken) client := &http.Client{} res, err := client.Do(req) if err != nil { return nil, []byte{}, err } defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) return res, body, nil }