Skip to content

Commit

Permalink
Use our own comparison for headers
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Sep 12, 2022
1 parent 78530d7 commit 0662081
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions nats.go
Expand Up @@ -32,7 +32,6 @@ import (
"net/url"
"os"
"path/filepath"
"reflect"
"regexp"
"runtime"
"strconv"
Expand Down Expand Up @@ -646,7 +645,21 @@ func (m *Msg) Equal(msg *Msg) bool {
if !bytes.Equal(m.Data, msg.Data) {
return false
}
return reflect.DeepEqual(m.Header, msg.Header)
if len(m.Header) != len(msg.Header) {
return false
}
for k, v := range m.Header {
val, ok := msg.Header[k]
if !ok || len(v) != len(val) {
return false
}
for i, hdr := range v {
if hdr != val[i] {
return false
}
}
}
return true
}

func (m *Msg) headerBytes() ([]byte, error) {
Expand Down

0 comments on commit 0662081

Please sign in to comment.