buildMultipartResponse constructs a StopDesktopRecordingResponse with the given content type/data pairs encoded as multipart/mixed.
(parts ...partSpec)
| 48 | // buildMultipartResponse constructs a StopDesktopRecordingResponse |
| 49 | // with the given content type/data pairs encoded as multipart/mixed. |
| 50 | func buildMultipartResponse(parts ...partSpec) workspacesdk.StopDesktopRecordingResponse { |
| 51 | var buf bytes.Buffer |
| 52 | mw := multipart.NewWriter(&buf) |
| 53 | for _, p := range parts { |
| 54 | partWriter, _ := mw.CreatePart(textproto.MIMEHeader{ |
| 55 | "Content-Type": {p.contentType}, |
| 56 | }) |
| 57 | _, _ = partWriter.Write(p.data) |
| 58 | } |
| 59 | _ = mw.Close() |
| 60 | return workspacesdk.StopDesktopRecordingResponse{ |
| 61 | Body: io.NopCloser(bytes.NewReader(buf.Bytes())), |
| 62 | ContentType: "multipart/mixed; boundary=" + mw.Boundary(), |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | func validRecordingMP4(extra int, fill byte) []byte { |
| 67 | data := []byte{0x00, 0x00, 0x00, 0x18, 'f', 't', 'y', 'p', 'm', 'p', '4', '2', 0x00, 0x00, 0x00, 0x00, 'm', 'p', '4', '1', 'i', 's', 'o', 'm'} |
no test coverage detected