2020-09-30 16:40:06 +00:00
|
|
|
package middleware
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
// AppInfo adds application name and version headers to the response
|
|
|
|
func AppInfo(name string, version string) func(http.Handler) http.Handler {
|
2020-11-07 11:59:33 +00:00
|
|
|
return func(next http.Handler) http.Handler {
|
|
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
2020-09-30 16:40:06 +00:00
|
|
|
w.Header().Set("App-Name", name)
|
|
|
|
w.Header().Set("App-Version", version)
|
|
|
|
|
2020-11-07 11:59:33 +00:00
|
|
|
next.ServeHTTP(w, r)
|
|
|
|
})
|
2020-09-30 16:40:06 +00:00
|
|
|
}
|
|
|
|
}
|