(fileSize int64, path string, fieldName string)
| 10 | ) |
| 11 | |
| 12 | func CalculateRequestSize(fileSize int64, path string, fieldName string) (int64, error) { |
| 13 | body := &bytes.Buffer{} |
| 14 | form := multipart.NewWriter(body) |
| 15 | |
| 16 | bpFileName := filepath.Base(path) |
| 17 | |
| 18 | _, err := form.CreateFormFile(fieldName, bpFileName) |
| 19 | if err != nil { |
| 20 | return 0, err |
| 21 | } |
| 22 | |
| 23 | err = form.Close() |
| 24 | if err != nil { |
| 25 | return 0, err |
| 26 | } |
| 27 | |
| 28 | return int64(body.Len()) + fileSize, nil |
| 29 | } |
| 30 | |
| 31 | func CreateMultipartBodyAndHeader(file io.Reader, path string, fieldName string) (string, io.ReadSeeker, <-chan error) { |
| 32 | writerOutput, writerInput := cloudcontroller.NewPipeBomb() |
no test coverage detected