Skip to content

Commit

Permalink
chore: Improve logging and streaming for multipart file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ShocOne committed Jun 6, 2024
1 parent 9253949 commit f688c4b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions httpclient/multipartrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,19 @@ func createStreamingMultipartRequestBody(files map[string][]string, formDataFiel

for fieldName, filePaths := range files {
for _, filePath := range filePaths {
log.Debug("Adding file part", zap.String("field_name", fieldName), zap.String("file_path", filePath))
if err := addFilePart(writer, fieldName, filePath, fileContentTypes, formDataPartHeaders, log); err != nil {
log.Error("Failed to add file part", zap.Error(err))

Check warning

Code scanning / gosec

Errors unhandled. Warning

Errors unhandled.
pw.CloseWithError(err)
return
}
}
}

for key, val := range formDataFields {
log.Debug("Adding form field", zap.String("field_name", key), zap.String("field_value", val))
if err := addFormField(writer, key, val, log); err != nil {
log.Error("Failed to add form field", zap.Error(err))

Check warning

Code scanning / gosec

Errors unhandled. Warning

Errors unhandled.
pw.CloseWithError(err)
return
}
Expand Down

0 comments on commit f688c4b

Please sign in to comment.