summaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-06-18 15:59:09 +0800
committerGitHub <noreply@github.com>2023-06-18 09:59:09 +0200
commit4e2f1ee58d1aa49f85c3a28a4f96e915f12bdb21 (patch)
treee2751e1c4673f6a051ef04ca156f428a819fdb66 /routers/web
parentfc2115b494e9ba7e4cf7a1440404dce53738b514 (diff)
downloadgitea-4e2f1ee58d1aa49f85c3a28a4f96e915f12bdb21.tar.gz
gitea-4e2f1ee58d1aa49f85c3a28a4f96e915f12bdb21.zip
Refactor web package and context package (#25298)
1. The "web" package shouldn't depends on "modules/context" package, instead, let each "web context" register themselves to the "web" package. 2. The old Init/Free doesn't make sense, so simplify it * The ctx in "Init(ctx)" is never used, and shouldn't be used that way * The "Free" is never called and shouldn't be called because the SSPI instance is shared --------- Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/admin/users_test.go10
-rw-r--r--routers/web/org/projects_test.go2
-rw-r--r--routers/web/repo/editor_test.go4
-rw-r--r--routers/web/repo/issue_label_test.go14
-rw-r--r--routers/web/repo/projects_test.go2
-rw-r--r--routers/web/repo/release_test.go4
-rw-r--r--routers/web/repo/settings_test.go22
-rw-r--r--routers/web/repo/wiki_test.go18
-rw-r--r--routers/web/user/home_test.go10
-rw-r--r--routers/web/user/setting/account_test.go2
-rw-r--r--routers/web/web.go9
11 files changed, 46 insertions, 51 deletions
diff --git a/routers/web/admin/users_test.go b/routers/web/admin/users_test.go
index ed58a54eef..19d6d7294d 100644
--- a/routers/web/admin/users_test.go
+++ b/routers/web/admin/users_test.go
@@ -19,7 +19,7 @@ import (
func TestNewUserPost_MustChangePassword(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "admin/users/new")
+ ctx, _ := test.MockContext(t, "admin/users/new")
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{
IsAdmin: true,
@@ -56,7 +56,7 @@ func TestNewUserPost_MustChangePassword(t *testing.T) {
func TestNewUserPost_MustChangePasswordFalse(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "admin/users/new")
+ ctx, _ := test.MockContext(t, "admin/users/new")
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{
IsAdmin: true,
@@ -93,7 +93,7 @@ func TestNewUserPost_MustChangePasswordFalse(t *testing.T) {
func TestNewUserPost_InvalidEmail(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "admin/users/new")
+ ctx, _ := test.MockContext(t, "admin/users/new")
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{
IsAdmin: true,
@@ -123,7 +123,7 @@ func TestNewUserPost_InvalidEmail(t *testing.T) {
func TestNewUserPost_VisibilityDefaultPublic(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "admin/users/new")
+ ctx, _ := test.MockContext(t, "admin/users/new")
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{
IsAdmin: true,
@@ -161,7 +161,7 @@ func TestNewUserPost_VisibilityDefaultPublic(t *testing.T) {
func TestNewUserPost_VisibilityPrivate(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "admin/users/new")
+ ctx, _ := test.MockContext(t, "admin/users/new")
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{
IsAdmin: true,
diff --git a/routers/web/org/projects_test.go b/routers/web/org/projects_test.go
index 3450fa8e72..08a97b7d2d 100644
--- a/routers/web/org/projects_test.go
+++ b/routers/web/org/projects_test.go
@@ -15,7 +15,7 @@ import (
func TestCheckProjectBoardChangePermissions(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/-/projects/4/4")
+ ctx, _ := test.MockContext(t, "user2/-/projects/4/4")
test.LoadUser(t, ctx, 2)
ctx.ContextUser = ctx.Doer // user2
ctx.SetParams(":id", "4")
diff --git a/routers/web/repo/editor_test.go b/routers/web/repo/editor_test.go
index 1e53aac9b0..52dded68b7 100644
--- a/routers/web/repo/editor_test.go
+++ b/routers/web/repo/editor_test.go
@@ -41,7 +41,7 @@ func TestCleanUploadName(t *testing.T) {
func TestGetUniquePatchBranchName(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1")
+ ctx, _ := test.MockContext(t, "user2/repo1")
ctx.SetParams(":id", "1")
test.LoadRepo(t, ctx, 1)
test.LoadRepoCommit(t, ctx)
@@ -56,7 +56,7 @@ func TestGetUniquePatchBranchName(t *testing.T) {
func TestGetClosestParentWithFiles(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1")
+ ctx, _ := test.MockContext(t, "user2/repo1")
ctx.SetParams(":id", "1")
test.LoadRepo(t, ctx, 1)
test.LoadRepoCommit(t, ctx)
diff --git a/routers/web/repo/issue_label_test.go b/routers/web/repo/issue_label_test.go
index c24fe898b6..4c9a359438 100644
--- a/routers/web/repo/issue_label_test.go
+++ b/routers/web/repo/issue_label_test.go
@@ -32,7 +32,7 @@ func int64SliceToCommaSeparated(a []int64) string {
func TestInitializeLabels(t *testing.T) {
unittest.PrepareTestEnv(t)
assert.NoError(t, repository.LoadRepoConfig())
- ctx := test.MockContext(t, "user2/repo1/labels/initialize")
+ ctx, _ := test.MockContext(t, "user2/repo1/labels/initialize")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 2)
web.SetForm(ctx, &forms.InitializeLabelsForm{TemplateName: "Default"})
@@ -57,7 +57,7 @@ func TestRetrieveLabels(t *testing.T) {
{1, "leastissues", []int64{2, 1}},
{2, "", []int64{}},
} {
- ctx := test.MockContext(t, "user/repo/issues")
+ ctx, _ := test.MockContext(t, "user/repo/issues")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, testCase.RepoID)
ctx.Req.Form.Set("sort", testCase.Sort)
@@ -75,7 +75,7 @@ func TestRetrieveLabels(t *testing.T) {
func TestNewLabel(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/labels/edit")
+ ctx, _ := test.MockContext(t, "user2/repo1/labels/edit")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
web.SetForm(ctx, &forms.CreateLabelForm{
@@ -93,7 +93,7 @@ func TestNewLabel(t *testing.T) {
func TestUpdateLabel(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/labels/edit")
+ ctx, _ := test.MockContext(t, "user2/repo1/labels/edit")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
web.SetForm(ctx, &forms.CreateLabelForm{
@@ -113,7 +113,7 @@ func TestUpdateLabel(t *testing.T) {
func TestDeleteLabel(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/labels/delete")
+ ctx, _ := test.MockContext(t, "user2/repo1/labels/delete")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
ctx.Req.Form.Set("id", "2")
@@ -126,7 +126,7 @@ func TestDeleteLabel(t *testing.T) {
func TestUpdateIssueLabel_Clear(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/issues/labels")
+ ctx, _ := test.MockContext(t, "user2/repo1/issues/labels")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
ctx.Req.Form.Set("issue_ids", "1,3")
@@ -151,7 +151,7 @@ func TestUpdateIssueLabel_Toggle(t *testing.T) {
{"toggle", []int64{1, 2}, 2, true},
} {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/issues/labels")
+ ctx, _ := test.MockContext(t, "user2/repo1/issues/labels")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
ctx.Req.Form.Set("issue_ids", int64SliceToCommaSeparated(testCase.IssueIDs))
diff --git a/routers/web/repo/projects_test.go b/routers/web/repo/projects_test.go
index c712902ea9..e2797772a8 100644
--- a/routers/web/repo/projects_test.go
+++ b/routers/web/repo/projects_test.go
@@ -14,7 +14,7 @@ import (
func TestCheckProjectBoardChangePermissions(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/projects/1/2")
+ ctx, _ := test.MockContext(t, "user2/repo1/projects/1/2")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
ctx.SetParams(":id", "1")
diff --git a/routers/web/repo/release_test.go b/routers/web/repo/release_test.go
index 9ec1b4d349..07e349811e 100644
--- a/routers/web/repo/release_test.go
+++ b/routers/web/repo/release_test.go
@@ -47,7 +47,7 @@ func TestNewReleasePost(t *testing.T) {
} {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/releases/new")
+ ctx, _ := test.MockContext(t, "user2/repo1/releases/new")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
test.LoadGitRepo(t, ctx)
@@ -67,7 +67,7 @@ func TestNewReleasePost(t *testing.T) {
func TestNewReleasesList(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo-release/releases")
+ ctx, _ := test.MockContext(t, "user2/repo-release/releases")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 57)
test.LoadGitRepo(t, ctx)
diff --git a/routers/web/repo/settings_test.go b/routers/web/repo/settings_test.go
index 3bb202505c..a33e92c821 100644
--- a/routers/web/repo/settings_test.go
+++ b/routers/web/repo/settings_test.go
@@ -42,7 +42,7 @@ func TestAddReadOnlyDeployKey(t *testing.T) {
}
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/settings/keys")
+ ctx, _ := test.MockContext(t, "user2/repo1/settings/keys")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 2)
@@ -71,7 +71,7 @@ func TestAddReadWriteOnlyDeployKey(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/settings/keys")
+ ctx, _ := test.MockContext(t, "user2/repo1/settings/keys")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 2)
@@ -94,7 +94,7 @@ func TestAddReadWriteOnlyDeployKey(t *testing.T) {
func TestCollaborationPost(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/issues/labels")
+ ctx, _ := test.MockContext(t, "user2/repo1/issues/labels")
test.LoadUser(t, ctx, 2)
test.LoadUser(t, ctx, 4)
test.LoadRepo(t, ctx, 1)
@@ -129,7 +129,7 @@ func TestCollaborationPost(t *testing.T) {
func TestCollaborationPost_InactiveUser(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/issues/labels")
+ ctx, _ := test.MockContext(t, "user2/repo1/issues/labels")
test.LoadUser(t, ctx, 2)
test.LoadUser(t, ctx, 9)
test.LoadRepo(t, ctx, 1)
@@ -152,7 +152,7 @@ func TestCollaborationPost_InactiveUser(t *testing.T) {
func TestCollaborationPost_AddCollaboratorTwice(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/issues/labels")
+ ctx, _ := test.MockContext(t, "user2/repo1/issues/labels")
test.LoadUser(t, ctx, 2)
test.LoadUser(t, ctx, 4)
test.LoadRepo(t, ctx, 1)
@@ -193,7 +193,7 @@ func TestCollaborationPost_AddCollaboratorTwice(t *testing.T) {
func TestCollaborationPost_NonExistentUser(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/issues/labels")
+ ctx, _ := test.MockContext(t, "user2/repo1/issues/labels")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
@@ -215,7 +215,7 @@ func TestCollaborationPost_NonExistentUser(t *testing.T) {
func TestAddTeamPost(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "org26/repo43")
+ ctx, _ := test.MockContext(t, "org26/repo43")
ctx.Req.Form.Set("team", "team11")
@@ -255,7 +255,7 @@ func TestAddTeamPost(t *testing.T) {
func TestAddTeamPost_NotAllowed(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "org26/repo43")
+ ctx, _ := test.MockContext(t, "org26/repo43")
ctx.Req.Form.Set("team", "team11")
@@ -295,7 +295,7 @@ func TestAddTeamPost_NotAllowed(t *testing.T) {
func TestAddTeamPost_AddTeamTwice(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "org26/repo43")
+ ctx, _ := test.MockContext(t, "org26/repo43")
ctx.Req.Form.Set("team", "team11")
@@ -336,7 +336,7 @@ func TestAddTeamPost_AddTeamTwice(t *testing.T) {
func TestAddTeamPost_NonExistentTeam(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "org26/repo43")
+ ctx, _ := test.MockContext(t, "org26/repo43")
ctx.Req.Form.Set("team", "team-non-existent")
@@ -369,7 +369,7 @@ func TestAddTeamPost_NonExistentTeam(t *testing.T) {
func TestDeleteTeam(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "org3/team1/repo3")
+ ctx, _ := test.MockContext(t, "org3/team1/repo3")
ctx.Req.Form.Set("id", "2")
diff --git a/routers/web/repo/wiki_test.go b/routers/web/repo/wiki_test.go
index e51820a520..d85879d1e5 100644
--- a/routers/web/repo/wiki_test.go
+++ b/routers/web/repo/wiki_test.go
@@ -78,7 +78,7 @@ func assertPagesMetas(t *testing.T, expectedNames []string, metas interface{}) {
func TestWiki(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/wiki/?action=_pages")
+ ctx, _ := test.MockContext(t, "user2/repo1/wiki/?action=_pages")
ctx.SetParams("*", "Home")
test.LoadRepo(t, ctx, 1)
Wiki(ctx)
@@ -90,7 +90,7 @@ func TestWiki(t *testing.T) {
func TestWikiPages(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/wiki/?action=_pages")
+ ctx, _ := test.MockContext(t, "user2/repo1/wiki/?action=_pages")
test.LoadRepo(t, ctx, 1)
WikiPages(ctx)
assert.EqualValues(t, http.StatusOK, ctx.Resp.Status())
@@ -100,7 +100,7 @@ func TestWikiPages(t *testing.T) {
func TestNewWiki(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/wiki/?action=_new")
+ ctx, _ := test.MockContext(t, "user2/repo1/wiki/?action=_new")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
NewWiki(ctx)
@@ -115,7 +115,7 @@ func TestNewWikiPost(t *testing.T) {
} {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/wiki/?action=_new")
+ ctx, _ := test.MockContext(t, "user2/repo1/wiki/?action=_new")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
web.SetForm(ctx, &forms.NewWikiForm{
@@ -133,7 +133,7 @@ func TestNewWikiPost(t *testing.T) {
func TestNewWikiPost_ReservedName(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/wiki/?action=_new")
+ ctx, _ := test.MockContext(t, "user2/repo1/wiki/?action=_new")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
web.SetForm(ctx, &forms.NewWikiForm{
@@ -150,7 +150,7 @@ func TestNewWikiPost_ReservedName(t *testing.T) {
func TestEditWiki(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/wiki/Home?action=_edit")
+ ctx, _ := test.MockContext(t, "user2/repo1/wiki/Home?action=_edit")
ctx.SetParams("*", "Home")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
@@ -166,7 +166,7 @@ func TestEditWikiPost(t *testing.T) {
"New/<page>",
} {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/wiki/Home?action=_new")
+ ctx, _ := test.MockContext(t, "user2/repo1/wiki/Home?action=_new")
ctx.SetParams("*", "Home")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
@@ -188,7 +188,7 @@ func TestEditWikiPost(t *testing.T) {
func TestDeleteWikiPagePost(t *testing.T) {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/wiki/Home?action=_delete")
+ ctx, _ := test.MockContext(t, "user2/repo1/wiki/Home?action=_delete")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
DeleteWikiPagePost(ctx)
@@ -207,7 +207,7 @@ func TestWikiRaw(t *testing.T) {
} {
unittest.PrepareTestEnv(t)
- ctx := test.MockContext(t, "user2/repo1/wiki/raw/"+url.PathEscape(filepath))
+ ctx, _ := test.MockContext(t, "user2/repo1/wiki/raw/"+url.PathEscape(filepath))
ctx.SetParams("*", filepath)
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
diff --git a/routers/web/user/home_test.go b/routers/web/user/home_test.go
index 534b0b2620..3a06a38c24 100644
--- a/routers/web/user/home_test.go
+++ b/routers/web/user/home_test.go
@@ -20,7 +20,7 @@ func TestArchivedIssues(t *testing.T) {
setting.UI.IssuePagingNum = 1
assert.NoError(t, unittest.LoadFixtures())
- ctx := test.MockContext(t, "issues")
+ ctx, _ := test.MockContext(t, "issues")
test.LoadUser(t, ctx, 30)
ctx.Req.Form.Set("state", "open")
@@ -53,7 +53,7 @@ func TestIssues(t *testing.T) {
setting.UI.IssuePagingNum = 1
assert.NoError(t, unittest.LoadFixtures())
- ctx := test.MockContext(t, "issues")
+ ctx, _ := test.MockContext(t, "issues")
test.LoadUser(t, ctx, 2)
ctx.Req.Form.Set("state", "closed")
Issues(ctx)
@@ -69,7 +69,7 @@ func TestPulls(t *testing.T) {
setting.UI.IssuePagingNum = 20
assert.NoError(t, unittest.LoadFixtures())
- ctx := test.MockContext(t, "pulls")
+ ctx, _ := test.MockContext(t, "pulls")
test.LoadUser(t, ctx, 2)
ctx.Req.Form.Set("state", "open")
Pulls(ctx)
@@ -82,7 +82,7 @@ func TestMilestones(t *testing.T) {
setting.UI.IssuePagingNum = 1
assert.NoError(t, unittest.LoadFixtures())
- ctx := test.MockContext(t, "milestones")
+ ctx, _ := test.MockContext(t, "milestones")
test.LoadUser(t, ctx, 2)
ctx.SetParams("sort", "issues")
ctx.Req.Form.Set("state", "closed")
@@ -101,7 +101,7 @@ func TestMilestonesForSpecificRepo(t *testing.T) {
setting.UI.IssuePagingNum = 1
assert.NoError(t, unittest.LoadFixtures())
- ctx := test.MockContext(t, "milestones")
+ ctx, _ := test.MockContext(t, "milestones")
test.LoadUser(t, ctx, 2)
ctx.SetParams("sort", "issues")
ctx.SetParams("repo", "1")
diff --git a/routers/web/user/setting/account_test.go b/routers/web/user/setting/account_test.go
index 569d597722..ba840db288 100644
--- a/routers/web/user/setting/account_test.go
+++ b/routers/web/user/setting/account_test.go
@@ -83,7 +83,7 @@ func TestChangePassword(t *testing.T) {
t.Run(req.OldPassword+"__"+req.NewPassword, func(t *testing.T) {
unittest.PrepareTestEnv(t)
setting.PasswordComplexity = req.PasswordComplexity
- ctx := test.MockContext(t, "user/settings/security")
+ ctx, _ := test.MockContext(t, "user/settings/security")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)
diff --git a/routers/web/web.go b/routers/web/web.go
index 8683ef221d..fae935a507 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -104,7 +104,7 @@ func ctxDataSet(args ...any) func(ctx *context.Context) {
}
// Routes returns all web routes
-func Routes(ctx gocontext.Context) *web.Route {
+func Routes() *web.Route {
routes := web.NewRoute()
routes.Head("/", misc.DummyOK) // for health check - doesn't need to be passed through gzip handler
@@ -146,13 +146,8 @@ func Routes(ctx gocontext.Context) *web.Route {
mid = append(mid, common.Sessioner(), context.Contexter())
- group := buildAuthGroup()
- if err := group.Init(ctx); err != nil {
- log.Error("Could not initialize '%s' auth method, error: %s", group.Name(), err)
- }
-
// Get user from session if logged in.
- mid = append(mid, auth_service.Auth(group))
+ mid = append(mid, auth_service.Auth(buildAuthGroup()))
// GetHead allows a HEAD request redirect to GET if HEAD method is not defined for that route
mid = append(mid, middleware.GetHead)