mirror of https://github.com/gin-gonic/gin.git
Merge 1818d94c5f
into e46bd52185
This commit is contained in:
commit
e68e51d784
|
@ -975,8 +975,12 @@ func bodyAllowedForStatus(status int) bool {
|
|||
}
|
||||
|
||||
// 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)
|
||||
return nil
|
||||
}
|
||||
return errors.New("invalid status code")
|
||||
}
|
||||
|
||||
// Header is an intelligent shortcut for c.Writer.Header().Set(key, value).
|
||||
|
|
Loading…
Reference in New Issue