Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add channel log for error with line attachments #711

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

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

Check warning on line 321 in handlers/line/handler.go

View check run for this annotation

Codecov / codecov/patch

handlers/line/handler.go#L321

Added line #L321 was not covered by tests
}
}

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
Loading