aboutsummaryrefslogtreecommitdiff
path: root/pkg/context/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/context/context.go')
-rw-r--r--pkg/context/context.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/context/context.go b/pkg/context/context.go
index 4213eaa4..40d7c8c7 100644
--- a/pkg/context/context.go
+++ b/pkg/context/context.go
@@ -89,6 +89,11 @@ func (c *Context) Success(name string) {
c.HTML(http.StatusOK, name)
}
+// JSONSuccess responses JSON with status http.StatusOK.
+func (c *Context) JSONSuccess(data interface{}) {
+ c.JSON(http.StatusOK, data)
+}
+
// RenderWithErr used for page has form validation but need to prompt error to users.
func (ctx *Context) RenderWithErr(msg, tpl string, f interface{}) {
if f != nil {