创建一个包装器以设置标题:
func wrap(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) ( w.Header().Set("Server", SERVER_NAME) h.ServeHTTP(w, r) })}包装单个处理程序
http.Handle("/path", wrap(aHandler)(http.Handle("/another/path", wrap(anotherHandler))或传递给ListenAndServe的根处理程序:
log.Fatal(http.ListenAndServe(addr, wrap(rootHandler))



