From 0d7315249d20bf9856605068074a7b6c6bcce835 Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 6 Dec 2020 23:16:02 +0100 Subject: Update vendor (#1330) --- vendor/github.com/Rhymen/go-whatsapp/read.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'vendor/github.com/Rhymen/go-whatsapp/read.go') 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]) { -- cgit v1.2.3