From f61da9cc2ee066df9ab2e1d8ac2f91039710b525 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Tue, 26 Nov 2024 16:34:09 +0100 Subject: [PATCH] Update content-type handling for FreeBSD in msgwriter test Adjusted the expected content-type header in msgwriter tests to account for FreeBSD by setting it to 'application/octet-stream' instead of 'text/plain'. This ensures compatibility and correct behavior across different operating systems. --- msgwriter_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/msgwriter_test.go b/msgwriter_test.go index d72c40c..3fd158c 100644 --- a/msgwriter_test.go +++ b/msgwriter_test.go @@ -346,8 +346,15 @@ func TestMsgWriter_addFiles(t *testing.T) { if msgwriter.err != nil { t.Errorf("msgWriter failed to write: %s", msgwriter.err) } - ctExpect := fmt.Sprintf(`Content-Type: text/plain; charset=utf-8; name="%s"`, tt.expect) + + var ctExpect string cdExpect := fmt.Sprintf(`Content-Disposition: attachment; filename="%s"`, tt.expect) + switch runtime.GOOS { + case "freebsd": + ctExpect = fmt.Sprintf(`Content-Type: application/octet-stream; charset=utf-8; name="%s"`, tt.expect) + default: + ctExpect = fmt.Sprintf(`Content-Type: text/plain; charset=utf-8; name="%s"`, tt.expect) + } if !strings.Contains(buffer.String(), ctExpect) { t.Errorf("expected content-type: %q, got: %q", ctExpect, buffer.String()) }