aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/handlers/generic/ping.go
blob: 00afd86bc3fb0f70342242a5644eaf8e7b91d160 (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
26
27
package generic

import (
	"fmt"
	"net/http"

	"github.com/containers/libpod/pkg/api/handlers"
)

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", handlers.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)
}