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:
@@ -335,7 +335,7 @@ func (hs *HTTPServer) addMiddlewaresAndStaticRoutes() {
|
||||
m.Use(middleware.Logger(hs.Cfg))
|
||||
|
||||
if hs.Cfg.EnableGzip {
|
||||
m.Use(middleware.Gziper())
|
||||
m.UseMiddleware(middleware.Gziper())
|
||||
}
|
||||
|
||||
m.Use(middleware.Recovery(hs.Cfg))
|
||||
@@ -354,11 +354,7 @@ func (hs *HTTPServer) addMiddlewaresAndStaticRoutes() {
|
||||
m.SetURLPrefix(hs.Cfg.AppSubURL)
|
||||
}
|
||||
|
||||
m.Use(macaron.Renderer(macaron.RenderOptions{
|
||||
Directory: filepath.Join(hs.Cfg.StaticRootPath, "views"),
|
||||
IndentJSON: macaron.Env != macaron.PROD,
|
||||
Delims: macaron.Delims{Left: "[[", Right: "]]"},
|
||||
}))
|
||||
m.UseMiddleware(macaron.Renderer(filepath.Join(hs.Cfg.StaticRootPath, "views"), "[[", "]]"))
|
||||
|
||||
// These endpoints are used for monitoring the Grafana instance
|
||||
// and should not be redirected or rejected.
|
||||
@@ -408,7 +404,7 @@ func (hs *HTTPServer) healthzHandler(ctx *macaron.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.WriteHeader(200)
|
||||
ctx.Resp.WriteHeader(200)
|
||||
_, err := ctx.Resp.Write([]byte("Ok"))
|
||||
if err != nil {
|
||||
hs.log.Error("could not write to response", "err", err)
|
||||
|
||||
Reference in New Issue
Block a user