MCPcopy Create free account
hub / github.com/kataras/iris / StopWithJSON

Method StopWithJSON

context/context.go:843–846  ·  view source on GitHub ↗

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{})

Source from the content-addressed store, hash-verified

841// If the status code is a failure one then
842// it will also fire the specified error code handler.
843func (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.

Callers 15

writeInternalServerErrorFunction · 0.80
writeEntityNotFoundFunction · 0.80
CreateMethod · 0.80
UpdateMethod · 0.80
PartialUpdateMethod · 0.80
CreateMethod · 0.80
UpdateMethod · 0.80
PartialUpdateMethod · 0.80
InsertProductsMethod · 0.80
helloWorldHandlerFunction · 0.80
failFunction · 0.80
myErrorHandlerFunction · 0.80

Calls 2

StopWithStatusMethod · 0.95
writeJSONMethod · 0.95

Tested by

no test coverage detected