AbortWithStatus calls `Abort()` and writes the headers with the specified status code. For example, a failed attempt to authenticate a request could use: context.AbortWithStatus(401).
(code int)
| 211 | // AbortWithStatus calls `Abort()` and writes the headers with the specified status code. |
| 212 | // For example, a failed attempt to authenticate a request could use: context.AbortWithStatus(401). |
| 213 | func (c *Context) AbortWithStatus(code int) { |
| 214 | c.Status(code) |
| 215 | c.Writer.WriteHeaderNow() |
| 216 | c.Abort() |
| 217 | } |
| 218 | |
| 219 | // AbortWithStatusPureJSON calls `Abort()` and then `PureJSON` internally. |
| 220 | // This method stops the chain, writes the status code and return a JSON body without escaping. |