MM-10201: querystring for get slash commands (#8779)
* pass GET slash command payloads through query string Previously, both GET and POST requests received the payload via the body, but this was incorrect for GET requests. Now, the payloads for GET requests is sent via the query string. * reorder tests for clarity * switch command tests to use httptest servers * restore original test command endpoints
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
6a9aa855d1
Коммит
a1656dffa9
@@ -230,12 +230,14 @@ func (a *App) ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *
|
||||
p.Set("response_url", args.SiteURL+"/hooks/commands/"+hook.Id)
|
||||
}
|
||||
|
||||
method := "POST"
|
||||
var req *http.Request
|
||||
if cmd.Method == model.COMMAND_METHOD_GET {
|
||||
method = "GET"
|
||||
req, _ = http.NewRequest(http.MethodGet, cmd.URL, nil)
|
||||
req.URL.RawQuery = p.Encode()
|
||||
} else {
|
||||
req, _ = http.NewRequest(http.MethodPost, cmd.URL, strings.NewReader(p.Encode()))
|
||||
}
|
||||
|
||||
req, _ := http.NewRequest(method, cmd.URL, strings.NewReader(p.Encode()))
|
||||
req.Header.Set("Accept", "application/json")
|
||||
req.Header.Set("Authorization", "Token "+cmd.Token)
|
||||
if cmd.Method == model.COMMAND_METHOD_POST {
|
||||
|
||||
Ссылка в новой задаче
Block a user