MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / sampleMultipart

Function sampleMultipart

internal/mailparse/attachments_test.go:13–35  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

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.
13func 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
37func TestAttachments_OrderAndDecode(t *testing.T) {
38 atts := Attachments(sampleMultipart())

Callers 2

TestAttachmentAt_BoundsFunction · 0.85

Calls 1

b64Function · 0.85

Tested by

no test coverage detected