MakeReq makes an HTTP request and returns a response
(endpoint string, method, path, data string)
| 159 | |
| 160 | // MakeReq makes an HTTP request and returns a response |
| 161 | func MakeReq(endpoint string, method, path, data string) *http.Request { |
| 162 | u := fmt.Sprintf("%s%s", endpoint, path) |
| 163 | |
| 164 | req, err := http.NewRequest(method, u, strings.NewReader(data)) |
| 165 | |
| 166 | if err != nil { |
| 167 | panic(errors.Wrap(err, "constructing http request")) |
| 168 | } |
| 169 | |
| 170 | return req |
| 171 | } |
| 172 | |
| 173 | // MakeFormReq makes an HTTP request and returns a response |
| 174 | func MakeFormReq(endpoint, method, path string, data url.Values) *http.Request { |
no outgoing calls