clearMiddlewareContext clears both Fiber locals and the request context because session middleware stores these values in both layers.
(c fiber.Ctx)
| 151 | // clearMiddlewareContext clears both Fiber locals and the request context |
| 152 | // because session middleware stores these values in both layers. |
| 153 | func clearMiddlewareContext(c fiber.Ctx) { |
| 154 | c.Locals(sessionIDContextKey, "") |
| 155 | c.Locals(middlewareContextKey, nil) |
| 156 | ctx := context.WithValue(c.Context(), sessionIDContextKey, "") |
| 157 | c.SetContext(context.WithValue(ctx, middlewareContextKey, (*Middleware)(nil))) |
| 158 | } |
| 159 | |
| 160 | // initialize sets up middleware for the request. It returns an error when the |
| 161 | // session cannot be loaded from the store (e.g. the backing storage is down) |
no test coverage detected