1
0
Fork 0
mirror of synced 2025-04-04 21:53:37 +03:00

correct declaration for Buttons

This commit is contained in:
Pavel 2021-02-17 15:24:10 +03:00
parent d4acc115a0
commit 6ed8d5d12b
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"}`)
}