MCPcopy
hub / github.com/gofiber/fiber / clearMiddlewareContext

Function clearMiddlewareContext

middleware/session/middleware.go:153–158  ·  view source on GitHub ↗

clearMiddlewareContext clears both Fiber locals and the request context because session middleware stores these values in both layers.

(c fiber.Ctx)

Source from the content-addressed store, hash-verified

151// clearMiddlewareContext clears both Fiber locals and the request context
152// because session middleware stores these values in both layers.
153func 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)

Callers 1

releaseMiddlewareFunction · 0.85

Calls 3

LocalsMethod · 0.65
ContextMethod · 0.65
SetContextMethod · 0.65

Tested by

no test coverage detected