Skip to content

Comments

feat(headers): sync SuperHeaders with native Headers#10889

Closed
alexandredev3 wants to merge 3 commits intoremix-run:mainfrom
alexandredev3:sync-super-headers-with-native-headers
Closed

feat(headers): sync SuperHeaders with native Headers#10889
alexandredev3 wants to merge 3 commits intoremix-run:mainfrom
alexandredev3:sync-super-headers-with-native-headers

Conversation

@alexandredev3
Copy link

This PR synchronizes SuperHeaders with the parent Headers class to ensure compatibility with Bun.

Previously, SuperHeaders stored data only in its internal #map without updating the parent Headers state. As a result, when running on Bun, the Response constructor would receive empty headers.

This appears to be because Bun accesses the parent Headers class's internal storage directly, bypassing overridden methods. Other runtimes, such as Node.js, seem to rely on JavaScript-level methods like entries(), which is why they behaved correctly.

The most reliable solution found was to explicitly call methods like super.append, super.set, and super.delete alongside the internal updates to make Headers state visible to Bun.

resolves #10872

@MichaelDeBoey MichaelDeBoey changed the title Sync super headers with native headers feat(headers): sync super headers with native headers Dec 13, 2025
@MichaelDeBoey MichaelDeBoey changed the title feat(headers): sync super headers with native headers feat(headers): sync SuperHeaders with native Headers Dec 13, 2025
@markdalgleish
Copy link
Member

Thanks for raising this issue. I further explored what a complete solution would look like here: #10904. This most notably adds support for detecting mutations to header property accessors, e.g. headers.allow = ['GET', 'POST', 'PUT'].

As a result, we've opted instead to simplify the model, avoiding subclassing Headers and other native classes in order to avoid this category of issue entirely: #10911

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[headers] SuperHeaders not compatible with Bun's Response constructor

3 participants