1
0
mirror of synced 2024-11-25 14:26:09 +03:00

Correct declaration for Buttons

This commit is contained in:
Pavel 2021-02-17 15:25:52 +03:00 committed by GitHub
parent d4acc115a0
commit 60ab2b27eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -508,7 +508,7 @@ type StructuredMessageElement struct {
ItemURL string `json:"item_url,omitempty"`
Subtitle string `json:"subtitle"`
DefaultAction *DefaultAction `json:"default_action,omitempty"`
Buttons *[]StructuredMessageButton `json:"buttons"`
Buttons *[]StructuredMessageButton `json:"buttons,omitempty"`
ReceiptMessageElement
}

17
response_test.go Normal file
View File

@ -0,0 +1,17 @@
package messenger
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_MarshalStructuredMessageElement(t *testing.T) {
data, err := json.Marshal(StructuredMessageElement{
Title: "Title",
})
require.NoError(t, err)
assert.JSONEq(t, string(data), `{"image_url":"", "subtitle":"", "title": "Title"}`)
}