Handle errors

This commit is contained in:
Maximilian 2023-08-03 12:13:15 -05:00
parent eda5344685
commit 7cb36db3c2

View File

@ -21,9 +21,17 @@ func SendRequest(url string, method string, headers map[string]string, body inte
reqBody = &bytes.Buffer{} reqBody = &bytes.Buffer{}
writer := multipart.NewWriter(reqBody) writer := multipart.NewWriter(reqBody)
for key, value := range v { 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() contentType = writer.FormDataContentType()
default: default:
jsonBody, err := json.Marshal(body) jsonBody, err := json.Marshal(body)