PLT-1649: add response_url support for custom slash commands (#6739)
* add response_url support for custom slash commands * pr suggestions * pr update / suggestion * test fix
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
5cd45c9394
Коммит
b122381e87
@@ -18,6 +18,30 @@ func TestCommandResponseJson(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommandResponseFromHTTPBody(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
ContentType string
|
||||
Body string
|
||||
ExpectedText string
|
||||
}{
|
||||
{"", "foo", "foo"},
|
||||
{"text/plain", "foo", "foo"},
|
||||
{"application/json", `{"text": "foo"}`, "foo"},
|
||||
} {
|
||||
response := CommandResponseFromHTTPBody(test.ContentType, strings.NewReader(test.Body))
|
||||
if response.Text != test.ExpectedText {
|
||||
t.Fatal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommandResponseFromPlainText(t *testing.T) {
|
||||
response := CommandResponseFromPlainText("foo")
|
||||
if response.Text != "foo" {
|
||||
t.Fatal("text should be foo")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommandResponseFromJson(t *testing.T) {
|
||||
json := `{
|
||||
"response_type": "ephemeral",
|
||||
|
||||
Ссылка в новой задаче
Block a user