package utils import ( "bytes" "encoding/json" "io" "net/http" ) func MakeRequest(method, url string, body interface{}) (*http.Response, error) { var reqBody io.Reader if body != nil { jsonBody, err := json.Marshal(body) if err != nil { return nil, err } reqBody = bytes.NewBuffer(jsonBody) } req, err := http.NewRequest(method, url, reqBody) if err != nil { return nil, err } if body != nil { req.Header.Set("Content-Type", "application/json") } client := &http.Client{} return client.Do(req) }