summaryrefslogtreecommitdiffstats
path: root/modules/context/context.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2016-11-25 14:51:01 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2016-11-25 14:53:59 +0800
commitfaabc76fd68b0ecccba1dc8dae47220b28cce05a (patch)
treed0a7f9b6417bc0bf596b3e0ed4f53e055d90a930 /modules/context/context.go
parent6a28909f40ad1ff20d325d9be4ada87e5b75ce53 (diff)
downloadgitea-faabc76fd68b0ecccba1dc8dae47220b28cce05a.tar.gz
gitea-faabc76fd68b0ecccba1dc8dae47220b28cce05a.zip
Golint fixed for modules/context
Diffstat (limited to 'modules/context/context.go')
-rw-r--r--modules/context/context.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/context/context.go b/modules/context/context.go
index fd3798b508..0535da995a 100644
--- a/modules/context/context.go
+++ b/modules/context/context.go
@@ -40,8 +40,8 @@ type Context struct {
Org *Organization
}
-// HasError returns true if error occurs in form validation.
-func (ctx *Context) HasApiError() bool {
+// HasAPIError returns true if error occurs in form validation.
+func (ctx *Context) HasAPIError() bool {
hasErr, ok := ctx.Data["HasError"]
if !ok {
return false
@@ -49,6 +49,7 @@ func (ctx *Context) HasApiError() bool {
return hasErr.(bool)
}
+// GetErrMsg returns error message
func (ctx *Context) GetErrMsg() string {
return ctx.Data["ErrorMsg"].(string)
}
@@ -116,6 +117,7 @@ func (ctx *Context) NotFoundOrServerError(title string, errck func(error) bool,
ctx.Handle(500, title, err)
}
+// HandleText handles HTTP status code
func (ctx *Context) HandleText(status int, title string) {
if (status/100 == 4) || (status/100 == 5) {
log.Error(4, "%s", title)
@@ -123,6 +125,7 @@ func (ctx *Context) HandleText(status int, title string) {
ctx.PlainText(status, []byte(title))
}
+// ServeContent serves content to http request
func (ctx *Context) ServeContent(name string, r io.ReadSeeker, params ...interface{}) {
modtime := time.Now()
for _, p := range params {