您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

15 行
337B

  1. package middleware
  2. import "net/http"
  3. func Header(values map[string]string) func(http.Handler) http.Handler {
  4. return func(next http.Handler) http.Handler {
  5. return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
  6. for key, value := range values {
  7. w.Header().Set(key, value)
  8. }
  9. next.ServeHTTP(w, r)
  10. })
  11. }
  12. }