[MM-10754] Remove unnecessary command_test route (#9050)
* remove unnecessary command_test route * replaced localhost with ts.URL
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
a92f5addcc
Коммит
9e5ec7d09d
@@ -4,7 +4,6 @@
|
||||
package api4
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -22,9 +21,6 @@ func (api *API) InitCommand() {
|
||||
|
||||
api.BaseRoutes.Team.Handle("/commands/autocomplete", api.ApiSessionRequired(listAutocompleteCommands)).Methods("GET")
|
||||
api.BaseRoutes.Command.Handle("/regen_token", api.ApiSessionRequired(regenCommandToken)).Methods("PUT")
|
||||
|
||||
api.BaseRoutes.Teams.Handle("/command_test", api.ApiHandler(testCommand)).Methods("POST")
|
||||
api.BaseRoutes.Teams.Handle("/command_test", api.ApiHandler(testCommand)).Methods("GET")
|
||||
}
|
||||
|
||||
func createCommand(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
@@ -291,25 +287,3 @@ func regenCommandToken(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
w.Write([]byte(model.MapToJson(resp)))
|
||||
}
|
||||
|
||||
func testCommand(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
r.ParseForm()
|
||||
|
||||
msg := ""
|
||||
if r.Method == "POST" {
|
||||
msg = msg + "\ntoken=" + r.FormValue("token")
|
||||
msg = msg + "\nteam_domain=" + r.FormValue("team_domain")
|
||||
} else {
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
msg = string(body)
|
||||
}
|
||||
|
||||
rc := &model.CommandResponse{
|
||||
Text: "test command response " + msg,
|
||||
ResponseType: model.COMMAND_RESPONSE_TYPE_IN_CHANNEL,
|
||||
Type: "custom_test",
|
||||
Props: map[string]interface{}{"someprop": "somevalue"},
|
||||
}
|
||||
|
||||
w.Write([]byte(rc.ToJson()))
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user