Skip to content

Commit

Permalink
Update by reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
kojisaikiAtSony committed May 14, 2024
1 parent 29dc396 commit 14c8798
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
7 changes: 3 additions & 4 deletions app/gosqs/send_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package gosqs

import (
"net/http"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -53,11 +52,11 @@ func SendMessageV1(req *http.Request) (int, interfaces.AbstractResponseBody) {
}

delaySecs := app.SyncQueues.Queues[queueName].DelaySeconds
if mv := req.FormValue("DelaySeconds"); mv != "" {
delaySecs, _ = strconv.Atoi(mv)
if requestBody.DelaySeconds != 0 {
delaySecs = requestBody.DelaySeconds
}

log.Println("Putting Message in Queue:", queueName)
log.Debugf("Putting Message in Queue: [%s]", queueName)
msg := app.Message{MessageBody: []byte(messageBody)}
if len(messageAttributes) > 0 {
oldStyleMessageAttributes := convertToOldMessageAttributeValueStructure(messageAttributes)
Expand Down
14 changes: 4 additions & 10 deletions app/gosqs/send_message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ import (
"github.com/stretchr/testify/assert"
)

func TestSendMessage_MaximumMessageSize_Success(t *testing.T) {
func TestSendMessage_Success(t *testing.T) {
req, err := http.NewRequest("POST", "/", nil)
if err != nil {
t.Fatal(err)
}
assert.Nil(t, err)

app.SyncQueues.Queues["test_max_message_size"] =
&app.Queue{Name: "test_max_message_size", MaximumMessageSize: 100}
Expand Down Expand Up @@ -45,9 +43,7 @@ func TestSendMessage_MaximumMessageSize_Success(t *testing.T) {

func TestSendMessage_MaximumMessageSize_MessageTooBig(t *testing.T) {
req, err := http.NewRequest("POST", "/", nil)
if err != nil {
t.Fatal(err)
}
assert.Nil(t, err)

app.SyncQueues.Queues["test_max_message_size"] =
&app.Queue{Name: "test_max_message_size", MaximumMessageSize: 10}
Expand Down Expand Up @@ -81,9 +77,7 @@ func TestSendQueue_POST_NonExistant(t *testing.T) {
// Create a request to pass to our handler. We don't have any query parameters for now, so we'll
// pass 'nil' as the third parameter.
req, err := http.NewRequest("POST", "/", nil)
if err != nil {
t.Fatal(err)
}
assert.Nil(t, err)

form := url.Values{}
form.Add("Action", "SendMessage")
Expand Down
4 changes: 2 additions & 2 deletions app/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ type SendMessageRequest struct {
QueueUrl string `json:"QueueUrl" schema:"QueueUrl"`
}
type MessageAttributeValue struct {
BinaryListValues []string `json:"BinaryListValues"` // goaws does not supported yet
BinaryListValues []string `json:"BinaryListValues"` // currently unsupported by AWS
BinaryValue string `json:"BinaryValue"`
DataType string `json:"DataType"`
StringListValues []string `json:"StringListValues"` // goaws does not supported yet
StringListValues []string `json:"StringListValues"` // currently unsupported by AWS
StringValue string `json:"StringValue"`
}

Expand Down

0 comments on commit 14c8798

Please sign in to comment.