Skip to main content

31 posts tagged with "go"

View All Tags

Custom Context in Practice

ยท 4 min read
Fiber Team
Maintainers

As backend services mature, handlers start repeating the same request plumbing over and over again. Tenant resolution, actor identification, correlation values, access-scoped metadata. None of this is business logic, but all of it is required before any business logic can run.

In a typical multi-tenant API, every handler opens with five or six lines of header extraction and default-value logic. When that logic is duplicated across fifty endpoints, small inconsistencies creep in. One handler reads X-Tenant-ID, another reads X-TenantID, a third falls back to a query parameter. Custom context gives that plumbing a single, typed home.

Binding in Practice

ยท 6 min read
Fiber Team
Maintainers

Request parsing is one of the easiest places to create hidden technical debt.

At the beginning of a project, mixed parsing styles seem harmless. A quick c.Query() here, a manual json.Unmarshal(c.Body(), &req) there, a c.Params() somewhere else. After enough endpoints, input behavior becomes unpredictable. One handler parses the body with a JSON decoder, another uses form tags, a third reads query parameters with individual calls. When bugs appear, you have to trace parsing logic per endpoint instead of trusting a shared convention.

Fiber v3 binding exists to make that convention explicit. c.Bind() is not just a new method name. It is a structured API that supports every input source, has defined precedence rules, integrates validation, and supports custom decoders. If your team agrees on binding, input handling stops being a source of surprises.

New Client Deep Dive

ยท 6 min read
Fiber Team
Maintainers

In many backend teams, outbound HTTP calls are still treated like helper code. They live in random utility functions, each call has slightly different timeout behavior, and when incidents happen no one is fully sure which upstream policy is actually active.

That works while a service has two dependencies. It starts to hurt when a service has ten. Timeout drift, inconsistent retry behavior, missing correlation headers, and ad-hoc error mapping become real operational problems. When your on-call engineer cannot tell which upstream policy is in effect during an incident, the outbound client is the root cause even when the upstream itself is fine.

The v3 client package addresses this by treating outbound HTTP as a first-class concern. You define client behavior once, override it where needed, and keep request policy visible in one place.