diff --git a/ctx.go b/ctx.go index 1b1ea50..464ac01 100644 --- a/ctx.go +++ b/ctx.go @@ -255,8 +255,8 @@ func (c *Ctx) Status(code int) *Ctx { c.lock.Lock() defer c.lock.Unlock() - c.StatusCode = code - c.writermem.status = code + c.writermem.WriteHeader(code) + c.StatusCode = c.writermem.status return c } diff --git a/response_writer.go b/response_writer.go index 62a1fcf..ccafc0b 100644 --- a/response_writer.go +++ b/response_writer.go @@ -103,7 +103,7 @@ func (w *responseWriter) Size() int { } func (w *responseWriter) Written() bool { - return w.size != noWritten || w.status != 0 + return w.size != noWritten } // Hijack implements the http.Hijacker interface.