Skip to content

Refactor httpResponseHeaders to use Headers class from relic package #4102

Closed

Description

@coderabbitai

Description

The httpResponseHeaders should use the Headers class from the relic package instead of the current Map implementation for better type safety and API consistency.

Affected Files

  • packages/serverpod/lib/src/server/server.dart:180

Context

// TODO: Make httpResponseHeaders a Headers object from the get-go.
// or better yet, use middleware
final headers = Headers.build((mh) {
  for (var rh in httpResponseHeaders.entries) {
    mh[rh.key] = ['${rh.value}'];
  }
});

Suggested Implementation

  • Change httpResponseHeaders from Map<String, String> to use the Headers class from the relic package directly
  • Refactor code to use the Headers type throughout the codebase
  • Update related APIs to work with the new type
  • Consider using middleware as suggested in the comment
  • Ensure backward compatibility or provide migration guide
  • Add tests for header manipulation

Impact

Type safety, API consistency, better developer experience

Related

Activity

  1. added
    enhancement
    on Oct 27, 2025
  2. moved this from Inbox 📫 to Planned 🔭 in Serverpod Frameworkson Oct 30, 2025
  3. added
    area: web server
    on Oct 30, 2025
  4. moved this from Planned 🔭 to Next Up 🎯 in Serverpod Frameworkson Oct 30, 2025
  5. added this to the 3.0 Release milestone on Oct 30, 2025
  6. self-assigned this
    on Oct 31, 2025
  7. moved this from Next Up 🎯 to In Progress 🔥 in Serverpod Frameworkson Oct 31, 2025
  8. moved this from In Progress 🔥 to Done 🚀 in Serverpod Frameworkson Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: web serverenhancement

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions