diff --git a/msg_test.go b/msg_test.go index 14e5f18..b86be9f 100644 --- a/msg_test.go +++ b/msg_test.go @@ -216,6 +216,9 @@ func (mw uppercaseMiddleware) Handle(m *Msg) *Msg { if !ok { fmt.Println("can't find the subject header") } + if s == nil || len(s) < 1 { + s = append(s, "") + } m.Subject(strings.ToUpper(s[0])) return m } @@ -231,6 +234,9 @@ func (mw encodeMiddleware) Handle(m *Msg) *Msg { if !ok { fmt.Println("can't find the subject header") } + if s == nil || len(s) < 1 { + s = append(s, "") + } m.Subject(strings.Replace(s[0], "a", "@", -1)) return m }