18 lines
422 B
Go
18 lines
422 B
Go
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 {
|
|
return func(next http.Handler) http.Handler {
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("App-Name", name)
|
|
w.Header().Set("App-Version", version)
|
|
|
|
next.ServeHTTP(w, r)
|
|
})
|
|
}
|
|
}
|