mirror of
https://github.com/gin-gonic/gin.git
synced 2025-04-25 19:22:46 +08:00
Merge 1818d94c5fe6dc89033952689bdf900a28c056c4 into 8763f33c65f7df8be5b9fe7504ab7fcf20abb41d
This commit is contained in:
commit
699ef26c9b
@ -975,8 +975,12 @@ func bodyAllowedForStatus(status int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Status sets the HTTP response code.
|
// Status sets the HTTP response code.
|
||||||
func (c *Context) Status(code int) {
|
func (c *Context) Status(code int) error {
|
||||||
|
if code > 0 {
|
||||||
c.Writer.WriteHeader(code)
|
c.Writer.WriteHeader(code)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return errors.New("invalid status code")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header is an intelligent shortcut for c.Writer.Header().Set(key, value).
|
// Header is an intelligent shortcut for c.Writer.Header().Set(key, value).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user