mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-27 16:05:08 +01:00
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.
This commit is contained in:
parent
75c0e3319b
commit
f61da9cc2e
1 changed files with 8 additions and 1 deletions
|
@ -346,8 +346,15 @@ func TestMsgWriter_addFiles(t *testing.T) {
|
||||||
if msgwriter.err != nil {
|
if msgwriter.err != nil {
|
||||||
t.Errorf("msgWriter failed to write: %s", msgwriter.err)
|
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)
|
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) {
|
if !strings.Contains(buffer.String(), ctExpect) {
|
||||||
t.Errorf("expected content-type: %q, got: %q", ctExpect, buffer.String())
|
t.Errorf("expected content-type: %q, got: %q", ctExpect, buffer.String())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue