diff --git a/context.go b/context.go index e1d9be43..724695e3 100644 --- a/context.go +++ b/context.go @@ -1132,6 +1132,15 @@ func (c *Context) Render(code int, r render.Render) { return } + if c.Writer.Written() && IsDebugging() { + // Skip warning for SSE and streaming responses (status code -1) + if code != -1 { + if _, ok := r.(sse.Event); !ok { + debugPrint("[WARNING] Response body already written. Attempting to write again with status code %d", code) + } + } + } + if err := r.Render(c.Writer); err != nil { // Pushing error to c.Errors _ = c.Error(err)