(bodyWriter *io.PipeWriter, stream stream.Stream, contentType string, cancel context.CancelCauseFunc)
| 106 | } |
| 107 | |
| 108 | func (c DuClient) writeMultipartBody(bodyWriter *io.PipeWriter, stream stream.Stream, contentType string, cancel context.CancelCauseFunc) string { |
| 109 | formWriter := multipart.NewWriter(bodyWriter) |
| 110 | go func() { |
| 111 | defer func() { _ = bodyWriter.Close() }() |
| 112 | defer func() { _ = formWriter.Close() }() |
| 113 | err := c.writeMultipartForm(formWriter, stream, contentType) |
| 114 | if err != nil { |
| 115 | cancel(err) |
| 116 | return |
| 117 | } |
| 118 | }() |
| 119 | return formWriter.FormDataContentType() |
| 120 | } |
| 121 | |
| 122 | func (c DuClient) writeMultipartForm(writer *multipart.Writer, stream stream.Stream, contentType string) error { |
| 123 | filePart := textproto.MIMEHeader{} |
no test coverage detected