fix: set status not work

This commit is contained in:
loveuer 2024-05-22 14:08:34 +08:00
parent 479c4eef57
commit 16541e377c
2 changed files with 3 additions and 3 deletions

4
ctx.go
View File

@ -255,8 +255,8 @@ func (c *Ctx) Status(code int) *Ctx {
c.lock.Lock() c.lock.Lock()
defer c.lock.Unlock() defer c.lock.Unlock()
c.StatusCode = code c.writermem.WriteHeader(code)
c.writermem.status = code c.StatusCode = c.writermem.status
return c return c
} }

View File

@ -103,7 +103,7 @@ func (w *responseWriter) Size() int {
} }
func (w *responseWriter) Written() bool { func (w *responseWriter) Written() bool {
return w.size != noWritten || w.status != 0 return w.size != noWritten
} }
// Hijack implements the http.Hijacker interface. // Hijack implements the http.Hijacker interface.