Repository navigation
fix(node): normalize native content types when replying - #18655
Merged
kamilmysliwiec merged 1 commit intoNov 23, 2026
Merged
kamilmysliwiec merged 1 commit into
kamilmysliwiec merged 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
A handler returning text after
res.setHeader('Content-Type', 'text/html')sends that header without a charset. Wrappingres.send()changes it totext/html; charset=utf-8. Returned objects with a nativeapplication/jsonheader have the same inconsistency. This is the follow-up identified in the review of #18527.Issue Number: N/A
On commit
94df49d7898df2009fc6dd4900ed77847eb8aaab, run afternpm ci --legacy-peer-depsandnpm run build:Before:
text/html. After:text/html; charset=utf-8.What is the new behavior?
writeBody()uses the existing text-header normalization shared bysend()andjson(). It reads the current header after serialization, preserving error-header corrections and headers set bytoJSON(). Rendering uses the same writer and gets the same normalization.Explicit charsets, raw extension-like values, MIME types without a default charset, and binary replies stay unchanged. Strings still default to
text/plain.Regression:
npm test -- packages/platform-node/test/adapters/node-adapter.spec.ts packages/platform-node/test/adapters/node-request.spec.ts.Does this PR introduce a breaking change?
Other information
Full unit suite, CI lint, build, public types, changed-file formatting, and the HTTP-adapter/send-files integration suites pass. The integration run has three existing skipped tests and covers those two directories, not all integration tests.
No public API or dependency changes. This restores the existing header-normalization behavior, so no external documentation changes are needed.
Prepared by an automated contribution pipeline that I build and operate (https://github.com/clean99/software-factory); the tests and evidence above were produced by it.