From e745a45f9f6888494556d664084f78e6a95b99be Mon Sep 17 00:00:00 2001 From: yokishava Date: Thu, 3 Nov 2022 15:15:20 +0900 Subject: [PATCH] fix: remove omitempty from replace_original and delete_orginal of WebhookMessage --- webhooks.go | 4 ++-- webhooks_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/webhooks.go b/webhooks.go index 2f8fb47f6..e3233536a 100644 --- a/webhooks.go +++ b/webhooks.go @@ -21,8 +21,8 @@ type WebhookMessage struct { Parse string `json:"parse,omitempty"` Blocks *Blocks `json:"blocks,omitempty"` ResponseType string `json:"response_type,omitempty"` - ReplaceOriginal bool `json:"replace_original,omitempty"` - DeleteOriginal bool `json:"delete_original,omitempty"` + ReplaceOriginal bool `json:"replace_original"` + DeleteOriginal bool `json:"delete_original"` ReplyBroadcast bool `json:"reply_broadcast,omitempty"` } diff --git a/webhooks_test.go b/webhooks_test.go index 6068802db..90b7e285d 100644 --- a/webhooks_test.go +++ b/webhooks_test.go @@ -77,15 +77,15 @@ func TestWebhookMessage_WithBlocks(t *testing.T) { assert.Equal(t, 1, len(msgSingleBlock.Blocks.BlockSet)) msgJsonSingleBlock, _ := json.Marshal(msgSingleBlock) - assert.Equal(t, `{"blocks":[{"type":"section","text":{"type":"plain_text","text":"text"}}]}`, string(msgJsonSingleBlock)) + assert.Equal(t, `{"blocks":[{"type":"section","text":{"type":"plain_text","text":"text"}}],"replace_original":false,"delete_original":false}`, string(msgJsonSingleBlock)) msgTwoBlocks := WebhookMessage{Blocks: twoBlocks} assert.Equal(t, 2, len(msgTwoBlocks.Blocks.BlockSet)) msgJsonTwoBlocks, _ := json.Marshal(msgTwoBlocks) - assert.Equal(t, `{"blocks":[{"type":"section","text":{"type":"plain_text","text":"text"}},{"type":"section","text":{"type":"plain_text","text":"text"}}]}`, string(msgJsonTwoBlocks)) + assert.Equal(t, `{"blocks":[{"type":"section","text":{"type":"plain_text","text":"text"}},{"type":"section","text":{"type":"plain_text","text":"text"}}],"replace_original":false,"delete_original":false}`, string(msgJsonTwoBlocks)) msgNoBlocks := WebhookMessage{Text: "foo"} msgJsonNoBlocks, _ := json.Marshal(msgNoBlocks) - assert.Equal(t, `{"text":"foo"}`, string(msgJsonNoBlocks)) + assert.Equal(t, `{"text":"foo","replace_original":false,"delete_original":false}`, string(msgJsonNoBlocks)) }