mirror of https://github.com/gin-gonic/gin.git
Only emit a warning is the status code changes
This commit is contained in:
parent
99694bb716
commit
59c836e1fa
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue