mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
[refactor] replace int with httpStatusCodes (#15282)
* replace "200" (int) with "http.StatusOK" (const) * ctx.Error & ctx.HTML * ctx.JSON Part1 * ctx.JSON Part2 * ctx.JSON Part3
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
gotemplate "html/template"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"strconv"
|
||||
@@ -582,7 +583,7 @@ func Home(ctx *context.Context) {
|
||||
ctx.Data["Repo"] = ctx.Repo
|
||||
ctx.Data["MigrateTask"] = task
|
||||
ctx.Data["CloneAddr"] = safeURL(cfg.CloneAddr)
|
||||
ctx.HTML(200, tplMigrating)
|
||||
ctx.HTML(http.StatusOK, tplMigrating)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -641,7 +642,7 @@ func renderCode(ctx *context.Context) {
|
||||
ctx.Data["PageIsViewCode"] = true
|
||||
|
||||
if ctx.Repo.Repository.IsEmpty {
|
||||
ctx.HTML(200, tplRepoEMPTY)
|
||||
ctx.HTML(http.StatusOK, tplRepoEMPTY)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -704,7 +705,7 @@ func renderCode(ctx *context.Context) {
|
||||
ctx.Data["TreeLink"] = treeLink
|
||||
ctx.Data["TreeNames"] = treeNames
|
||||
ctx.Data["BranchLink"] = branchLink
|
||||
ctx.HTML(200, tplRepoHome)
|
||||
ctx.HTML(http.StatusOK, tplRepoHome)
|
||||
}
|
||||
|
||||
// RenderUserCards render a page show users according the input templaet
|
||||
@@ -726,7 +727,7 @@ func RenderUserCards(ctx *context.Context, total int, getter func(opts models.Li
|
||||
}
|
||||
ctx.Data["Cards"] = items
|
||||
|
||||
ctx.HTML(200, tpl)
|
||||
ctx.HTML(http.StatusOK, tpl)
|
||||
}
|
||||
|
||||
// Watchers render repository's watch users
|
||||
@@ -765,5 +766,5 @@ func Forks(ctx *context.Context) {
|
||||
}
|
||||
ctx.Data["Forks"] = forks
|
||||
|
||||
ctx.HTML(200, tplForks)
|
||||
ctx.HTML(http.StatusOK, tplForks)
|
||||
}
|
||||
|
Reference in New Issue
Block a user