From 9e5ec7d09d4c51e278f17f25fb6c0f3484b50a3b Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Fri, 6 Jul 2018 21:07:42 +0800 Subject: [MM-10754] Remove unnecessary command_test route (#9050) * remove unnecessary command_test route * replaced localhost with ts.URL --- api4/command.go | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'api4/command.go') diff --git a/api4/command.go b/api4/command.go index 3ab2839ba..69efee010 100644 --- a/api4/command.go +++ b/api4/command.go @@ -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())) -} -- cgit v1.2.3-1-g7c22