Welcome to mirror list, hosted at ThFree Co, Russian Federation.

middleware.go « healthcheck « internal - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2ddd35b70bd70e6f20f53ac2929710cd3eb164ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package healthcheck

import (
	"net/http"
)

// NewMiddleware is serving the application status check
func NewMiddleware(handler http.Handler, statusPath string) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		if r.URL.Path == statusPath {
			w.Header().Set("Cache-Control", "no-store")
			w.Write([]byte("success\n"))

			return
		}

		handler.ServeHTTP(w, r)
	})
}