Handle errors

This commit is contained in:
Maximilian 2023-08-03 12:13:15 -05:00
parent eda5344685
commit 7cb36db3c2
1 changed files with 10 additions and 2 deletions

View File

@ -21,9 +21,17 @@ func SendRequest(url string, method string, headers map[string]string, body inte
reqBody = &bytes.Buffer{}
writer := multipart.NewWriter(reqBody)
for key, value := range v {
writer.WriteField(key, value)
err := writer.WriteField(key, value)
if err != nil {
return http.Response{}, err
}
}
writer.Close()
err := writer.Close()
if err != nil {
return http.Response{}, err
}
contentType = writer.FormDataContentType()
default:
jsonBody, err := json.Marshal(body)