-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds content-type message header to support other content-types such …
- Loading branch information
Showing
12 changed files
with
317 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*eml text eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,11 +24,12 @@ import ( | |
func TestNewHeaders(t *testing.T) { | ||
assert := assert.New(t) | ||
type args struct { | ||
date time.Time | ||
from Address | ||
to Address | ||
replyTo *Address | ||
subject string | ||
date time.Time | ||
from Address | ||
to Address | ||
replyTo *Address | ||
subject string | ||
contentType string | ||
} | ||
tests := []struct { | ||
name string | ||
|
@@ -43,12 +44,32 @@ func TestNewHeaders(t *testing.T) { | |
Address{ChainAddress: "0x92d8f10248c6a3953cc3692a894655ad05d61efb", DisplayName: "", FullAddress: "[email protected]"}, | ||
nil, | ||
"Hello World", | ||
"text/plain; charset=\"UTF-8\"", | ||
}, | ||
&Headers{ | ||
Date: time.Date(2001, 01, 02, 03, 04, 5, 6, time.UTC), | ||
From: Address{ChainAddress: "5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761"}, | ||
To: Address{ChainAddress: "0x92d8f10248c6a3953cc3692a894655ad05d61efb", DisplayName: "", FullAddress: "[email protected]"}, | ||
Subject: "Hello World", | ||
Date: time.Date(2001, 01, 02, 03, 04, 5, 6, time.UTC), | ||
From: Address{ChainAddress: "5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761"}, | ||
To: Address{ChainAddress: "0x92d8f10248c6a3953cc3692a894655ad05d61efb", DisplayName: "", FullAddress: "[email protected]"}, | ||
Subject: "Hello World", | ||
ContentType: "text/plain; charset=\"UTF-8\"", | ||
}, | ||
}, | ||
{ | ||
"html", | ||
args{ | ||
time.Date(2001, 01, 02, 03, 04, 5, 6, time.UTC), | ||
Address{ChainAddress: "5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761"}, | ||
Address{ChainAddress: "0x92d8f10248c6a3953cc3692a894655ad05d61efb", DisplayName: "", FullAddress: "[email protected]"}, | ||
nil, | ||
"Hello World", | ||
"text/html; charset=\"UTF-8\"", | ||
}, | ||
&Headers{ | ||
Date: time.Date(2001, 01, 02, 03, 04, 5, 6, time.UTC), | ||
From: Address{ChainAddress: "5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761"}, | ||
To: Address{ChainAddress: "0x92d8f10248c6a3953cc3692a894655ad05d61efb", DisplayName: "", FullAddress: "[email protected]"}, | ||
Subject: "Hello World", | ||
ContentType: "text/html; charset=\"UTF-8\"", | ||
}, | ||
}, | ||
{ | ||
|
@@ -59,19 +80,21 @@ func TestNewHeaders(t *testing.T) { | |
Address{ChainAddress: "0x92d8f10248c6a3953cc3692a894655ad05d61efb", DisplayName: "", FullAddress: "[email protected]"}, | ||
&Address{ChainAddress: "4cb0a77b76667dac586c40cc9523ace73b5d772bd503c63ed0ca596eae1658b2"}, | ||
"Hello World", | ||
"text/plain; charset=\"UTF-8\"", | ||
}, | ||
&Headers{ | ||
Date: time.Date(2001, 01, 02, 03, 04, 5, 6, time.UTC), | ||
From: Address{ChainAddress: "5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761"}, | ||
To: Address{ChainAddress: "0x92d8f10248c6a3953cc3692a894655ad05d61efb", DisplayName: "", FullAddress: "[email protected]"}, | ||
ReplyTo: &Address{ChainAddress: "4cb0a77b76667dac586c40cc9523ace73b5d772bd503c63ed0ca596eae1658b2"}, | ||
Subject: "Hello World", | ||
Date: time.Date(2001, 01, 02, 03, 04, 5, 6, time.UTC), | ||
From: Address{ChainAddress: "5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761"}, | ||
To: Address{ChainAddress: "0x92d8f10248c6a3953cc3692a894655ad05d61efb", DisplayName: "", FullAddress: "[email protected]"}, | ||
ReplyTo: &Address{ChainAddress: "4cb0a77b76667dac586c40cc9523ace73b5d772bd503c63ed0ca596eae1658b2"}, | ||
Subject: "Hello World", | ||
ContentType: "text/plain; charset=\"UTF-8\"", | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got := NewHeaders(tt.args.date, tt.args.from, tt.args.to, tt.args.replyTo, tt.args.subject) | ||
got := NewHeaders(tt.args.date, tt.args.from, tt.args.to, tt.args.replyTo, tt.args.subject, tt.args.contentType) | ||
if !assert.Equal(got, tt.want) { | ||
t.Errorf("NewHeaders() = %v, want %v", got, tt.want) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.