你可以创建自己的http.ResponseWriter来做到这一点,或者你可以只使用“中间件模式”:// foo is the main handlertype foo struct{}func (foo) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.Write([]byte("foo"))}// bar writes after footype bar struct { h http.Handler}func (b bar) ServeHTTP(w http.ResponseWriter, r *http.Request) { b.h.ServeHTTP(w, r) w.Write([]byte("BAR"))}游乐场:http : //play.golang.org/p/fB2OXNSTIe。