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

Function HandlerFromContext

middleware/csrf/csrf.go:255–261  ·  view source on GitHub ↗

HandlerFromContext returns the Handler found in the context. It accepts fiber.CustomCtx, fiber.Ctx, *fasthttp.RequestCtx, and context.Context. It returns nil if the handler does not exist.

(ctx any)

Source from the content-addressed store, hash-verified

253// It accepts fiber.CustomCtx, fiber.Ctx, *fasthttp.RequestCtx, and context.Context.
254// It returns nil if the handler does not exist.
255func HandlerFromContext(ctx any) *Handler {
256 if handler, ok := fiber.ValueFromContext[*Handler](ctx, handlerKey); ok {
257 return handler
258 }
259
260 return nil
261}
262
263// getRawFromStorage returns the raw value from the storage for the given token
264// returns nil if the token does not exist, is expired or is invalid

Calls

no outgoing calls