chronograf/server/version.go

15 lines
323 B
Go
Raw Normal View History

2017-01-13 23:10:50 +00:00
package server
import (
"net/http"
)
2017-03-06 16:11:52 +00:00
// Version handler adds X-Chronograf-Version header to responses
2017-01-13 23:10:50 +00:00
func Version(version string, h http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("X-Chronograf-Version", version)
h.ServeHTTP(w, r)
}
return http.HandlerFunc(fn)
}