response_writes uses 200 as default status code.

This commit is contained in:
Manu Mtz-Almeida 2014-08-18 19:48:01 +02:00
parent 3bd33ca666
commit e11ff5bacb

View File

@ -22,7 +22,7 @@ type (
func (w *responseWriter) reset(writer http.ResponseWriter) { func (w *responseWriter) reset(writer http.ResponseWriter) {
w.ResponseWriter = writer w.ResponseWriter = writer
w.status = 0 w.status = 200
w.written = false w.written = false
} }
@ -43,12 +43,7 @@ func (w *responseWriter) WriteHeaderNow() {
} }
func (w *responseWriter) Write(data []byte) (n int, err error) { func (w *responseWriter) Write(data []byte) (n int, err error) {
if !w.written { w.WriteHeaderNow()
if w.status != 0 {
w.ResponseWriter.WriteHeader(w.status)
}
w.written = true
}
return w.ResponseWriter.Write(data) return w.ResponseWriter.Write(data)
} }