summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/generic/ping.go
blob: 44a67d53f130d70e9eb761956b8f24d481e7fc8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
}