Macaron: Strip down renderer middleware (#37627)

* strip down macaron renderer

* inline renderHTML

* remove IndentJSON parameter

* replace renderer with a html/template set

* fix failing test

* fix renderer paths in tests

* make template reloading even simpler

* unify ignored gzip path lookup

* fix csp middleware usage
This commit is contained in:
Serge Zaitsev
2021-08-10 13:29:46 +02:00
committed by GitHub
parent 5b575ae91f
commit 707d3536f0
14 changed files with 145 additions and 765 deletions

View File

@ -58,11 +58,7 @@ func setupTestEnvironment(t *testing.T, cfg *setting.Cfg) (*macaron.Macaron, *HT
m := macaron.New()
m.Use(getContextHandler(t, cfg).Middleware)
m.Use(macaron.Renderer(macaron.RenderOptions{
Directory: filepath.Join(setting.StaticRootPath, "views"),
IndentJSON: true,
Delims: macaron.Delims{Left: "[[", Right: "]]"},
}))
m.UseMiddleware(macaron.Renderer(filepath.Join(setting.StaticRootPath, "views"), "[[", "]]"))
m.Get("/api/frontend/settings/", hs.GetFrontendSettings)
return m, hs