package tower import "net/http" type responseWriter struct { http.ResponseWriter status int wroteHeader bool } func (w *responseWriter) WriteHeader(code int) { if !w.wroteHeader { w.status = code w.wroteHeader = true } w.ResponseWriter.WriteHeader(code) } func (w *responseWriter) Write(b []byte) (int, error) { if !w.wroteHeader { w.WriteHeader(http.StatusOK) } return w.ResponseWriter.Write(b) } func (w *responseWriter) Status() int { if w.status == 0 { return http.StatusOK } return w.status }