summaryrefslogtreecommitdiffstats
path: root/api4
diff options
context:
space:
mode:
authorRobin Naundorf <r.naundorf@fh-muenster.de>2017-02-17 11:57:19 +0100
committerGeorge Goldberg <george@gberg.me>2017-02-17 10:57:19 +0000
commit48b785aded359c98cf0008bd652a4437ea807cbd (patch)
tree1458d3344f25a37bd1c369a0a885a44f628db58f /api4
parenteadf37ad7ab0c25764f22923bae60ef70daea75f (diff)
downloadchat-48b785aded359c98cf0008bd652a4437ea807cbd.tar.gz
chat-48b785aded359c98cf0008bd652a4437ea807cbd.tar.bz2
chat-48b785aded359c98cf0008bd652a4437ea807cbd.zip
Add APIv4 /system/ping endpoint (#5443)
Diffstat (limited to 'api4')
-rw-r--r--api4/api.go1
-rw-r--r--api4/system.go21
-rw-r--r--api4/system_test.go18
3 files changed, 40 insertions, 0 deletions
diff --git a/api4/api.go b/api4/api.go
index b05c1a7db..b352d0b15 100644
--- a/api4/api.go
+++ b/api4/api.go
@@ -143,6 +143,7 @@ func InitApi(full bool) {
InitTeam()
InitChannel()
InitPost()
+ InitSystem()
app.Srv.Router.Handle("/api/v4/{anything:.*}", http.HandlerFunc(Handle404))
diff --git a/api4/system.go b/api4/system.go
new file mode 100644
index 000000000..94f4718a2
--- /dev/null
+++ b/api4/system.go
@@ -0,0 +1,21 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package api4
+
+import (
+ "net/http"
+
+ l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/platform/utils"
+)
+
+func InitSystem() {
+ l4g.Debug(utils.T("api.system.init.debug"))
+
+ BaseRoutes.System.Handle("/ping", ApiHandler(getSystemPing)).Methods("GET")
+}
+
+func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) {
+ ReturnStatusOK(w)
+}
diff --git a/api4/system_test.go b/api4/system_test.go
new file mode 100644
index 000000000..d9514eabc
--- /dev/null
+++ b/api4/system_test.go
@@ -0,0 +1,18 @@
+package api4
+
+import (
+ "testing"
+)
+
+func TestGetPing(t *testing.T) {
+ th := Setup().InitBasic()
+ defer TearDown()
+ Client := th.Client
+
+ b, _ := Client.GetPing()
+ if b == false {
+ t.Fatal()
+ }
+}
+
+