Move logger middleware to capture routing errors (ex: 405). (#877)

* Fix #836

* Remove requestLogger middleware from MountRouter
This commit is contained in:
Josep Mª Domingo 2021-03-25 04:17:36 +01:00 committed by GitHub
parent cdb387b22f
commit 515aa7108b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -38,7 +38,6 @@ func (a *Server) MountRouter(urlPath string, subRouter Handler) {
log.Info("Mounting routes", "path", urlPath)
subRouter.Setup(urlPath)
a.router.Group(func(r chi.Router) {
r.Use(requestLogger)
r.Mount(urlPath, subRouter)
})
}
@ -59,6 +58,7 @@ func (a *Server) initRoutes() {
r.Use(middleware.Compress(5, "application/xml", "application/json", "application/javascript"))
r.Use(middleware.Heartbeat("/ping"))
r.Use(injectLogger)
r.Use(requestLogger)
r.Use(robotsTXT(ui.Assets()))
indexHtml := path.Join(conf.Server.BaseURL, consts.URLPathUI, "index.html")