Skip to content

Commit

Permalink
feat: Add NewEmptyHeader() function
Browse files Browse the repository at this point in the history
  • Loading branch information
LBeernaertProton committed Oct 25, 2022
1 parent 78adf76 commit 86bbf02
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rfc822/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ type Header struct {
data []byte
}

// NewEmptyHeader returns an empty header that can be filled with values.
func NewEmptyHeader() *Header {
h, err := NewHeader([]byte{'\r', '\n'})
// The above code should never fail, but just in case.
if err != nil {
panic(err)
}

return h
}

func NewHeader(data []byte) (*Header, error) {
h := &Header{
keys: make(map[string][]*headerEntry),
Expand Down

0 comments on commit 86bbf02

Please sign in to comment.