Merge 1818d94c5fe6dc89033952689bdf900a28c056c4 into 81dba468722f41347ed74ee66e9c1781d72f68a5

This commit is contained in:
arshabbir 2026-02-23 13:46:38 -04:00 committed by GitHub
commit 110693a0d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1069,8 +1069,12 @@ func bodyAllowedForStatus(status int) bool {
}
// Status sets the HTTP response code.
func (c *Context) Status(code int) {
c.Writer.WriteHeader(code)
func (c *Context) Status(code int) error {
if code > 0 {
c.Writer.WriteHeader(code)
return nil
}
return errors.New("invalid status code")
}
// Header is an intelligent shortcut for c.Writer.Header().Set(key, value).