CodeVetter · Repo Unpack · Behavior traces
gofiber/fiber
These traces follow source execution order across startup, request dispatch, decoding, persistence, and outbound networking. Startup includes side effects during New, before Listen. Request errors and unmatched paths have explicit branches, and sessions save while middleware unwinds. Timeout handling introduces a separate lifecycle because application handlers can continue running after the timeout response is selected.
- Startup begins New → validateConfiguredServices → configuration defaults → newSharedState → init → initServices → startServices; services successfully started are registered in State, and startup errors cause initServices to panic.
- Ordinary Listen follows listenConfigDefault → TLS configuration → startGracefulShutdown → createListener → startupProcess → prepareListenData → runOnListenHooks → printMessages → optional BeforeServeFunc → server.Serve; pre-Serve failures close the bound listener.
- startupProcess locks App, installs connection-state handling, collects nested sub-apps, creates automatic HEAD routes, expands mounts, and finally builds the route tree.
- Default request dispatch follows defaultRequestHandler → acquireDefaultCtx → Reset → method validation → optional flash clearing and skip resolution → next; returned errors reach App.ErrorHandler before deferred releaseDefaultCtx.
- next selects a method/path bucket and invokes the matched route's first handler; Ctx.Next advances within that handler list or resumes route scanning. Exhausted unmatched routing scans other methods, adds Allow entries, and returns 405 or 404.
- A JSON action follows Ctx.Bind().Body → custom MIME binder if registered, otherwise JSON → JSONBinding.Bind → configured decoder → validateStruct; parse errors remain BindError in manual mode or become status-400 Error in automatic mode.
- Session requests follow NewWithStore handler → initialize → Store.getSession → storeMiddlewareContext → c.Next → saveSession → saveSessionWithContext → Storage.SetWithContext → releaseSession/releaseMiddleware; initialization errors stop downstream execution, and destroyed sessions skip saving.
- Outbound execution follows core.execute → user request hooks → built-in serialization hooks → final request hooks → timeout → execFunc → optional retry/redirect transport → built-in response hooks → user response hooks; cancellation returns ErrTimeoutOrCancel and drains the eventual transport result.