From 1e86cfd6860b4e387206299fc101984e6d61259d Mon Sep 17 00:00:00 2001
From: Johan de Klerk <jdeklerk00@gmail.com>
Date: Wed, 9 Feb 2022 10:42:20 +0200
Subject: [PATCH] #24: Correctly check message length

---
 sqs/sqs.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sqs/sqs.go b/sqs/sqs.go
index 77c9928..829a710 100644
--- a/sqs/sqs.go
+++ b/sqs/sqs.go
@@ -3,7 +3,6 @@ package sqs
 /*Package sqs provides a simple interface to send messages to AWS SQS*/
 
 import (
-	"encoding/binary"
 	"encoding/json"
 	"fmt"
 	"github.com/google/uuid"
@@ -127,7 +126,7 @@ func SendSQSMessage(msgr Messenger, objectToSend interface{}, currentRequestID *
 
 	// If bigger than 200 KB upload message to s3 and send s3 file name to sqs
 	// The sqs receiver should check the header to see if the message is in the body or on s3
-	if binary.Size(message) > 0 {
+	if len(jsonBytes) > 0 {
 		headers[SQSMessageOnS3Key] = "true"
 		id := uuid.New()
 		filename := fmt.Sprintf("%v-%v", sqsType, id.String())
-- 
GitLab