Based on a need to parse the headers of a lot of emails, I've suggested a small patch to optionally do this following the suggestion in Discussions here.
A couple of points.
I thought the simplest way of making this change was to send an optional string to ParseEmail; eg: email, err := letters.ParseEmail(r, "HeadersOnly").
The email struct is reinitialised in ParseEmail to set the Headers -- see deleted line 26. I've changed that.
Partly because of 2. above I had an error in the test I copied and couldn't easily see what the error was. I used Google's go-cmp module which makes it easy to diff test errors.
This is my first github pull request. Please feel free to criticise it in any way.
Hi @mnako
Based on a need to parse the headers of a lot of emails, I've suggested a small patch to optionally do this following the suggestion in Discussions here.
A couple of points.
I thought the simplest way of making this change was to send an optional string to
ParseEmail
; eg:email, err := letters.ParseEmail(r, "HeadersOnly")
.The
email
struct is reinitialised in ParseEmail to set the Headers -- see deleted line 26. I've changed that.Partly because of 2. above I had an error in the test I copied and couldn't easily see what the error was. I used Google's
go-cmp
module which makes it easy to diff test errors.This is my first github pull request. Please feel free to criticise it in any way.
Cheers! Rory