aboutsummaryrefslogtreecommitdiff
path: root/pkg/context/context.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-04-06 00:14:30 -0400
committerUnknwon <u@gogs.io>2017-04-06 00:14:30 -0400
commita617d52374e937db0edacfba2a26bdd14a05538e (patch)
tree8c6448af2e4d68975ea66656b430e3b755e852c2 /pkg/context/context.go
parent624474386aa51b74fdbee04bb85aaa957a22b99c (diff)
2fa: initial support (#945)
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 {