From 3f280f89e7471a6dcdaefccc64a8d39188970e63 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Wed, 23 Mar 2022 05:54:07 +0100 Subject: Update HTTP status codes to modern codes (#18063) * 2xx/3xx/4xx/5xx -> http.Status... * http.StatusFound -> http.StatusTemporaryRedirect * http.StatusMovedPermanently -> http.StatusPermanentRedirect --- routers/web/user/home.go | 6 +++--- routers/web/user/setting/account_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'routers/web/user') diff --git a/routers/web/user/home.go b/routers/web/user/home.go index afdc344b69..0878e8d528 100644 --- a/routers/web/user/home.go +++ b/routers/web/user/home.go @@ -151,7 +151,7 @@ func Dashboard(ctx *context.Context) { func Milestones(ctx *context.Context) { if unit.TypeIssues.UnitGlobalDisabled() && unit.TypePullRequests.UnitGlobalDisabled() { log.Debug("Milestones overview page not available as both issues and pull requests are globally disabled") - ctx.Status(404) + ctx.Status(http.StatusNotFound) return } @@ -323,7 +323,7 @@ func Milestones(ctx *context.Context) { func Pulls(ctx *context.Context) { if unit.TypePullRequests.UnitGlobalDisabled() { log.Debug("Pull request overview page not available as it is globally disabled.") - ctx.Status(404) + ctx.Status(http.StatusNotFound) return } @@ -336,7 +336,7 @@ func Pulls(ctx *context.Context) { func Issues(ctx *context.Context) { if unit.TypeIssues.UnitGlobalDisabled() { log.Debug("Issues overview page not available as it is globally disabled.") - ctx.Status(404) + ctx.Status(http.StatusNotFound) return } diff --git a/routers/web/user/setting/account_test.go b/routers/web/user/setting/account_test.go index a67d09e9ed..005603e7ac 100644 --- a/routers/web/user/setting/account_test.go +++ b/routers/web/user/setting/account_test.go @@ -94,6 +94,6 @@ func TestChangePassword(t *testing.T) { AccountPost(ctx) assert.Contains(t, ctx.Flash.ErrorMsg, req.Message) - assert.EqualValues(t, http.StatusFound, ctx.Resp.Status()) + assert.EqualValues(t, http.StatusSeeOther, ctx.Resp.Status()) } } -- cgit v1.2.3