A multipart/mixed message: text body + a base64 PDF attachment + a named inline image. The two named parts are attachments; the text body is not.
()
| 11 | // A multipart/mixed message: text body + a base64 PDF attachment + a named |
| 12 | // inline image. The two named parts are attachments; the text body is not. |
| 13 | func sampleMultipart() []byte { |
| 14 | return []byte("From: a@x.com\r\n" + |
| 15 | "To: b@y.com\r\n" + |
| 16 | "Subject: hi\r\n" + |
| 17 | "MIME-Version: 1.0\r\n" + |
| 18 | "Content-Type: multipart/mixed; boundary=BOUND\r\n" + |
| 19 | "\r\n" + |
| 20 | "--BOUND\r\n" + |
| 21 | "Content-Type: text/plain\r\n" + |
| 22 | "\r\n" + |
| 23 | "the body text\r\n" + |
| 24 | "--BOUND\r\n" + |
| 25 | "Content-Type: application/pdf; name=\"report.pdf\"\r\n" + |
| 26 | "Content-Disposition: attachment; filename=\"report.pdf\"\r\n" + |
| 27 | "Content-Transfer-Encoding: base64\r\n" + |
| 28 | "\r\n" + b64("%PDF-1.4 fake pdf bytes") + "\r\n" + |
| 29 | "--BOUND\r\n" + |
| 30 | "Content-Type: image/png\r\n" + |
| 31 | "Content-Disposition: inline; filename=\"logo.png\"\r\n" + |
| 32 | "Content-Transfer-Encoding: base64\r\n" + |
| 33 | "\r\n" + b64("\x89PNG\r\n fake png") + "\r\n" + |
| 34 | "--BOUND--\r\n") |
| 35 | } |
| 36 | |
| 37 | func TestAttachments_OrderAndDecode(t *testing.T) { |
| 38 | atts := Attachments(sampleMultipart()) |
no test coverage detected