Handle errors
This commit is contained in:
parent
eda5344685
commit
7cb36db3c2
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user