Skip to content

Enhance Typed Headers to Handle Custom Header Definitions #41

Closed

Description

@SandPod

Problem to Solve

The current typed header system in Relic primarily supports common built-in headers and lacks a flexible mechanism for handling custom headers. This limits developers who need strong typing and validation for domain-specific or proprietary headers.

Proposal

Enhance the typed header implementation to fully support custom headers by:

  • Allowing developers to define their own typed header classes (e.g., X-Custom-User-ID)
  • Registering custom headers for parsing and serialization, similar to built-in headers
  • Supporting integration with request/response objects via a unified API
  • Validating header values based on user-defined types or rules

Use Case

A developer is building a microservice architecture that relies on custom headers for things like tracing (X-Trace-ID), auth tokens (X-App-Token), or tenant identification (X-Tenant-ID). They want these headers to be handled with type safety, proper parsing, and integrated developer tooling (autocomplete, validation, etc).

Alternatives

N/A

Additional context

This change would improve Relic’s ergonomics and extensibility, and bring the typed header API closer to the flexibility of frameworks like Express.js, but with type safety baked in. It also complements the goal of developer-friendliness, especially in large or multi-team projects.

How experienced are you with this library?

None

Are you interested in working on a PR for this?

  • I want to work on this

Activity

  1. added
    enhancement
    on Mar 25, 2025
  2. moved this to Next 🌟 in Relic Roadmapon Mar 25, 2025
  3. self-assigned this
    on Mar 25, 2025
  4. moved this from Next 🌟 to Now 🔥 in Relic Roadmapon Mar 25, 2025
  5. moved this from Now 🔥 to Done in Relic Roadmapon Apr 2, 2025
  6. moved this from Inbox 📫 to Done 🚀 in Serverpod Frameworkson Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions