summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-02-16 17:29:12 +0100
committerChristopher Speller <crspeller@gmail.com>2018-02-16 08:29:12 -0800
commit8c3a7b75de5be45a64dc06c4e998817e7b52d6bc (patch)
tree0fc63555836970e00eeedd7df648f58fb1a6199f /web
parent6d8f122a5160f6d9e4c51579f2429dfaa62c7271 (diff)
downloadchat-8c3a7b75de5be45a64dc06c4e998817e7b52d6bc.tar.gz
chat-8c3a7b75de5be45a64dc06c4e998817e7b52d6bc.tar.bz2
chat-8c3a7b75de5be45a64dc06c4e998817e7b52d6bc.zip
[PLT-539] Update incoming webhooks to accept multipart/form-data content (#7873)
Diffstat (limited to 'web')
-rw-r--r--web/web_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/web/web_test.go b/web/web_test.go
index c8d64c61d..5bc69b697 100644
--- a/web/web_test.go
+++ b/web/web_test.go
@@ -133,6 +133,12 @@ func TestIncomingWebhook(t *testing.T) {
if _, err := ApiClient.PostToWebhook("abc123", payload); err == nil {
t.Fatal("should have errored - bad hook")
}
+
+ payloadMultiPart := "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"username\"\r\n\r\nwebhook-bot\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"text\"\r\n\r\nthis is a test :tada:\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--"
+ if _, err := ApiClient.DoPost("/hooks/"+hook1.Id, payloadMultiPart, "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"); err != nil {
+ t.Fatal("should have errored - bad hook")
+ }
+
} else {
if _, err := ApiClient.PostToWebhook("123", "123"); err == nil {
t.Fatal("should have failed - webhooks turned off")