AbortWithStatusJSON calls `Abort()` and then `JSON` internally. This method stops the chain, writes the status code and return a JSON body. It also sets the Content-Type as "application/json".
(code int, jsonObj any)
| 228 | // This method stops the chain, writes the status code and return a JSON body. |
| 229 | // It also sets the Content-Type as "application/json". |
| 230 | func (c *Context) AbortWithStatusJSON(code int, jsonObj any) { |
| 231 | c.Abort() |
| 232 | c.JSON(code, jsonObj) |
| 233 | } |
| 234 | |
| 235 | // AbortWithError calls `AbortWithStatus()` and `Error()` internally. |
| 236 | // This method stops the chain, writes the status code and pushes the specified error to `c.Errors`. |