diff options
author | Wim <wim@42.be> | 2020-12-06 23:16:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-06 23:16:02 +0100 |
commit | 0d7315249d20bf9856605068074a7b6c6bcce835 (patch) | |
tree | f8ab7e0f3e96491e439eb49beebf3fae658215c4 /vendor/github.com/Rhymen/go-whatsapp/read.go | |
parent | 4913766d58cd1fe204b27dc93172c5dd4a95a88a (diff) | |
download | matterbridge-msglm-0d7315249d20bf9856605068074a7b6c6bcce835.tar.gz matterbridge-msglm-0d7315249d20bf9856605068074a7b6c6bcce835.tar.bz2 matterbridge-msglm-0d7315249d20bf9856605068074a7b6c6bcce835.zip |
Update vendor (#1330)
Diffstat (limited to 'vendor/github.com/Rhymen/go-whatsapp/read.go')
-rw-r--r-- | vendor/github.com/Rhymen/go-whatsapp/read.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/vendor/github.com/Rhymen/go-whatsapp/read.go b/vendor/github.com/Rhymen/go-whatsapp/read.go index 81e16619..1621c0f5 100644 --- a/vendor/github.com/Rhymen/go-whatsapp/read.go +++ b/vendor/github.com/Rhymen/go-whatsapp/read.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "io/ioutil" + "net/http" "strings" "github.com/Rhymen/go-whatsapp/binary" @@ -111,16 +112,16 @@ func (wac *Conn) decryptBinaryMessage(msg []byte) (*binary.Node, error) { var response struct { Status int `json:"status"` } - err := json.Unmarshal(msg, &response) - if err == nil { - if response.Status == 404 { + + if err := json.Unmarshal(msg, &response); err == nil { + if response.Status == http.StatusNotFound { return nil, ErrServerRespondedWith404 } return nil, errors.New(fmt.Sprintf("server responded with %d", response.Status)) - } else { - return nil, ErrInvalidServerResponse } + return nil, ErrInvalidServerResponse + } h2.Write([]byte(msg[32:])) if !hmac.Equal(h2.Sum(nil), msg[:32]) { |