CodeVetter · Repo Unpack · Data flow
gofiber/fiber
HTTP input enters through fasthttp and is attached to a recycled Fiber context. Routing transforms paths into matching state, while binders transform HTTP values into application-owned Go destinations. Response helpers write directly to fasthttp response objects. Session and shared-state operations cross explicit storage interfaces, with defensive copying at selected buffer-ownership boundaries.
- DefaultCtx.Reset resets routing indexes and flags, reads PathOriginal and method, attaches RequestCtx, normalizes matching paths, and reconnects DefaultReq/DefaultRes to the context.
- Route registration normalizes the pattern, parses raw and matching variants, adopts raw constraints, records parameter names, and copies middleware registrations into every configured method stack.
- Bind.JSON borrows JSONBinding, installs the configured decoder, feeds it c.Body(), wraps parse failures, validates the destination, and resets the binder on release.
- FormBinding normalizes form Content-Type, converts PostArgs into binding data, or parses multipart data with MaxBodySize and merges values and file headers into the decoder input.
- DefaultRes.JSON runs Config.JSONEncoder, assigns its bytes with SetBodyRaw, and chooses the supplied content type or the JSON UTF-8 default.
- Store.getSession resolves an incoming ID and provenance, fetches stored bytes, generates a new token when storage returns nil, decodes data into a pooled session, and applies absolute-expiration handling.
- Session saving updates cookie/header IDs, then either rewrites an unchanged raw snapshot or gob-encodes changed data and calls Storage.SetWithContext with the idle timeout; decoding copies storage-owned bytes first.
- SharedState derives a namespace from SharedStatePrefix or AppName and copies retrieved bytes; the session default memory backend separately copies stored keys/values and ignores expired entries.