diff --git a/response_writer.go b/response_writer.go index e659c4eb..9b1077ed 100644 --- a/response_writer.go +++ b/response_writer.go @@ -42,11 +42,11 @@ func (w *responseWriter) reset(writer http.ResponseWriter) { } func (w *responseWriter) WriteHeader(code int) { - if code > 0 { - w.status = code + if code > 0 && w.status != code { if w.Written() { - debugPrint("[WARNING] Headers were already written") + debugPrint("[WARNING] Headers were already written. Wanted to override status code %d with %d", w.status, code) } + w.status = code } }