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
1 changed files with 2 additions and 7 deletions

View File

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