Skip to content

Use standard Headers API instead of custom request context object #1300

@felixweinberger

Description

@felixweinberger

Summary

Replace custom request context objects with the standard web Headers API for better standards alignment and developer familiarity.

This was identified as a gap in the v2 wishlist (issue #809) that is not yet tracked as a separate issue.

Motivation

  • Standards alignment: The Headers API is a web standard that developers already know
  • Interoperability: Standard APIs work better across different runtimes (Node.js, Deno, Bun, browsers)
  • Developer experience: Familiar API reduces learning curve
  • Type safety: Headers has well-defined TypeScript types

Requirements

  1. Replace custom header/context objects with standard Headers API
  2. Update request context interfaces to use Headers
  3. Ensure compatibility with Node.js, Deno, Bun runtimes
  4. Provide migration guidance for existing code

API Changes

// Before (custom object)
interface RequestContext {
  headers: Record<string, string>;
  // ...
}

// After (standard Headers)
interface RequestContext {
  headers: Headers;
  // ...
}

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Moderate issues affecting some users, edge cases, potentially valuable featurebreaking changeWill break existing deployments when updated without changesenhancementRequest for a new feature that's not currently supportedready for workEnough information for someone to start working onv2Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions