summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/generic/ping.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api/handlers/generic/ping.go')
-rw-r--r--pkg/api/handlers/generic/ping.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/pkg/api/handlers/generic/ping.go b/pkg/api/handlers/generic/ping.go
new file mode 100644
index 000000000..44a67d53f
--- /dev/null
+++ b/pkg/api/handlers/generic/ping.go
@@ -0,0 +1,25 @@
+package generic
+
+import (
+ "fmt"
+ "net/http"
+)
+
+func PingGET(w http.ResponseWriter, _ *http.Request) {
+ setHeaders(w)
+ fmt.Fprintln(w, "OK")
+}
+
+func PingHEAD(w http.ResponseWriter, _ *http.Request) {
+ setHeaders(w)
+ fmt.Fprintln(w, "")
+}
+
+func setHeaders(w http.ResponseWriter) {
+ w.Header().Set("API-Version", DefaultApiVersion)
+ w.Header().Set("BuildKit-Version", "")
+ w.Header().Set("Docker-Experimental", "true")
+ w.Header().Set("Cache-Control", "no-cache")
+ w.Header().Set("Pragma", "no-cache")
+ w.WriteHeader(http.StatusOK)
+}