forked from forgejo/forgejo
Refactor routers directory (#15800)
* refactor routers directory * move func used for web and api to common * make corsHandler a function to prohibit side efects * rm unused func Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
e03a91a48e
commit
1bfb0a24d8
107 changed files with 940 additions and 800 deletions
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/routers/routes"
|
||||
"code.gitea.io/gitea/routers"
|
||||
|
||||
"gitea.com/go-chi/session"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
|
@ -58,7 +58,7 @@ func TestSessionFileCreation(t *testing.T) {
|
|||
oldSessionConfig := setting.SessionConfig.ProviderConfig
|
||||
defer func() {
|
||||
setting.SessionConfig.ProviderConfig = oldSessionConfig
|
||||
c = routes.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
}()
|
||||
|
||||
var config session.Options
|
||||
|
@ -84,7 +84,7 @@ func TestSessionFileCreation(t *testing.T) {
|
|||
|
||||
setting.SessionConfig.ProviderConfig = string(newConfigBytes)
|
||||
|
||||
c = routes.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
|
||||
t.Run("NoSessionOnViewIssue", func(t *testing.T) {
|
||||
defer PrintCurrentTest(t)()
|
||||
|
|
|
@ -34,7 +34,6 @@ import (
|
|||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/routers"
|
||||
"code.gitea.io/gitea/routers/routes"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
|
@ -88,7 +87,7 @@ func TestMain(m *testing.M) {
|
|||
defer cancel()
|
||||
|
||||
initIntegrationTest()
|
||||
c = routes.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
|
||||
// integration test settings...
|
||||
if setting.Cfg != nil {
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/lfs"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/routers/routes"
|
||||
"code.gitea.io/gitea/routers/web"
|
||||
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
gzipp "github.com/klauspost/compress/gzip"
|
||||
|
@ -99,7 +99,7 @@ func TestGetLFSLarge(t *testing.T) {
|
|||
t.Skip()
|
||||
return
|
||||
}
|
||||
content := make([]byte, routes.GzipMinSize*10)
|
||||
content := make([]byte, web.GzipMinSize*10)
|
||||
for i := range content {
|
||||
content[i] = byte(i % 256)
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ func TestGetLFSGzip(t *testing.T) {
|
|||
t.Skip()
|
||||
return
|
||||
}
|
||||
b := make([]byte, routes.GzipMinSize*10)
|
||||
b := make([]byte, web.GzipMinSize*10)
|
||||
for i := range b {
|
||||
b[i] = byte(i % 256)
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ func TestGetLFSZip(t *testing.T) {
|
|||
t.Skip()
|
||||
return
|
||||
}
|
||||
b := make([]byte, routes.GzipMinSize*10)
|
||||
b := make([]byte, web.GzipMinSize*10)
|
||||
for i := range b {
|
||||
b[i] = byte(i % 256)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue