forked from mtusi2026/mtusi2026lab5
15 lines
298 B
Go
15 lines
298 B
Go
package middleware
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func InstanceID(id 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("X-Instance-Id", id)
|
|
next.ServeHTTP(w, r)
|
|
})
|
|
}
|
|
}
|