Correct declaration for Buttons
This commit is contained in:
parent
d4acc115a0
commit
60ab2b27eb
@ -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
17
response_test.go
Normal 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"}`)
|
||||
}
|
Loading…
Reference in New Issue
Block a user