Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf0076b

Browse files
committed
add _ping endpoint
Docker-DCO-1.1-Signed-off-by: Victor Vieux <[email protected]> (github: vieux)
1 parent ac7b2b8 commit cf0076b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

api/server/server.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package server
33
import (
44
"bufio"
55
"bytes"
6-
"code.google.com/p/go.net/websocket"
76
"crypto/tls"
87
"crypto/x509"
98
"encoding/base64"
@@ -21,6 +20,8 @@ import (
2120
"strings"
2221
"syscall"
2322

23+
"code.google.com/p/go.net/websocket"
24+
2425
"github.com/dotcloud/docker/api"
2526
"github.com/dotcloud/docker/engine"
2627
"github.com/dotcloud/docker/pkg/listenbuffer"
@@ -976,6 +977,11 @@ func writeCorsHeaders(w http.ResponseWriter, r *http.Request) {
976977
w.Header().Add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS")
977978
}
978979

980+
func ping(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
981+
w.Write([]byte{'O', 'K'})
982+
return nil
983+
}
984+
979985
func makeHttpHandler(eng *engine.Engine, logging bool, localMethod string, localRoute string, handlerFunc HttpApiFunc, enableCors bool, dockerVersion version.Version) http.HandlerFunc {
980986
return func(w http.ResponseWriter, r *http.Request) {
981987
// log the request
@@ -1044,6 +1050,7 @@ func createRouter(eng *engine.Engine, logging, enableCors bool, dockerVersion st
10441050
}
10451051
m := map[string]map[string]HttpApiFunc{
10461052
"GET": {
1053+
"/_ping": ping,
10471054
"/events": getEvents,
10481055
"/info": getInfo,
10491056
"/version": getVersion,

0 commit comments

Comments
 (0)