Skip to content

Commit

Permalink
Merge pull request #711 from nyaruka/line-attachnment-err-log
Browse files Browse the repository at this point in the history
Add channel log for error with line attachments
  • Loading branch information
rowanseymour authored Mar 7, 2024
2 parents eee6313 + 59765cb commit 66ae5b7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions handlers/line/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ func (h *handler) Send(ctx context.Context, msg courier.MsgOut, res *courier.Sen

if err == nil {
jsonMsgs = append(jsonMsgs, string(jsonMsg))
} else {
return err
}
}

Expand Down
16 changes: 16 additions & 0 deletions handlers/line/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,22 @@ var defaultSendTestCases = []OutgoingTestCase{
},
},
},
{
Label: "Long messsage, Quick Reply combined and attachment",
MsgText: "This is a longer message than 160 characters and will cause us to split it into two separate parts, isn't that right but it is even longer than before I say, I need to keep adding more things to make it work",
MsgURN: "line:uabcdefghij",
MsgResponseToExternalID: "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
MsgAttachments: []string{"image/jpeg:http://mock.com/1234/test.jpg"},
MsgQuickReplies: []string{"Yes", "No"},
MockResponses: map[string][]*httpx.MockResponse{
"https://api.line.me/v2/bot/message/reply": {httpx.NewMockResponse(200, nil, []byte(`{}`))},
},
ExpectedRequests: []ExpectedRequest{
{
Body: `{"replyToken":"nHuyWiB7yP5Zw52FIkcQobQuGDXCTA","messages":[{"type":"image","originalContentUrl":"http://mock.com/1234/test.jpg","previewImageUrl":"http://mock.com/1234/test.jpg"},{"type":"text","text":"This is a longer message than 160 characters and will cause us to split it into two separate parts, isn't that right but it is even longer than before I say,"},{"type":"text","text":"I need to keep adding more things to make it work","quickReply":{"items":[{"type":"action","action":{"type":"message","label":"Yes","text":"Yes"}},{"type":"action","action":{"type":"message","label":"No","text":"No"}}]}}]}`,
},
},
},
{
Label: "Send Push Message If Invalid Reply",
MsgText: "Simple Message",
Expand Down

0 comments on commit 66ae5b7

Please sign in to comment.