StopWithJSON stops the handlers chain, writes the status code and sends a JSON response. If the status code is a failure one then it will also fire the specified error code handler.
(statusCode int, jsonObject interface{})
| 841 | // If the status code is a failure one then |
| 842 | // it will also fire the specified error code handler. |
| 843 | func (ctx *Context) StopWithJSON(statusCode int, jsonObject interface{}) error { |
| 844 | ctx.StopWithStatus(statusCode) |
| 845 | return ctx.writeJSON(jsonObject, &DefaultJSONOptions) // do not modify - see errors.DefaultContextErrorHandler. |
| 846 | } |
| 847 | |
| 848 | // StopWithProblem stops the handlers chain, writes the status code |
| 849 | // and sends an application/problem+json response. |
no test coverage detected