From c7072dba20e47e9198a6c2e0974fcacadae39a7d Mon Sep 17 00:00:00 2001 From: Peter Sanchez Date: Thu, 7 Jul 2022 14:15:36 -0600 Subject: [PATCH] Moving server Context up the middleware chain --- server/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/server.go b/server/server.go index 7abd71a..aa5f351 100644 --- a/server/server.go +++ b/server/server.go @@ -285,7 +285,6 @@ func (s *Server) WithDefaultMiddleware() *Server { s.e.Pre(middleware.RemoveTrailingSlashWithConfig(middleware.TrailingSlashConfig{ RedirectCode: http.StatusMovedPermanently, })) - s.e.Use(session.LoadAndSave(s.Session)) // Must be first // Set custom context s.e.Use(func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { @@ -293,6 +292,7 @@ func (s *Server) WithDefaultMiddleware() *Server { return next(ctx) } }) + s.e.Use(session.LoadAndSave(s.Session)) // Must be first s.e.Use( middleware.RecoverWithConfig(middleware.RecoverConfig{ StackSize: 32768, // 32KiB -- 2.45.2