From 59c836e1fadb3d830be38281aa0e69467adf8c01 Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Tue, 12 May 2015 18:31:31 +0200 Subject: [PATCH] Only emit a warning is the status code changes --- response_writer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 } }