From 16dea6cebd375fc274fc7a9c216dbcc9e22bd5c7 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 5 Apr 2021 17:30:52 +0200 Subject: [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 --- routers/repo/view.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'routers/repo/view.go') diff --git a/routers/repo/view.go b/routers/repo/view.go index 39f16d183c..568d9ec6be 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -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) } -- cgit v1.2.3