Skip to content

docs: update Reply.send() documentation for string serialization#6466

Merged
mcollina merged 1 commit intomainfrom
docs/update-reply-send-string-serialization
Jan 26, 2026
Merged

docs: update Reply.send() documentation for string serialization#6466
mcollina merged 1 commit intomainfrom
docs/update-reply-send-string-serialization

Conversation

@mcollina
Copy link
Member

Fixes #6291

Summary

The documentation previously claimed that reply.send(string) would automatically JSON-serialize strings when Content-Type is set to application/json. This behavior has never been implemented - strings are sent unmodified by default.

After discussion with maintainers in the issue, it was decided to update the documentation rather than change the behavior, since this behavior has existed since v2.12.0 (5-6 years) and changing it could be a breaking change.

Changes

  • Corrected the misleading documentation in docs/Reference/Reply.md under the Strings section
  • Added a note explaining that strings are sent unmodified by default, even when Content-Type is application/json
  • Added an example showing users how to use .serializer(JSON.stringify) to serialize strings as JSON when needed

This aligns the documentation with the actual behavior and provides users with a clear workaround.

Fixes #6291

The documentation previously claimed that reply.send(string) would
automatically JSON-serialize strings when Content-Type is set to
application/json; charset=utf-8. This behavior has never been
implemented - strings are sent unmodified by default.

Updated the documentation to reflect the actual behavior and added
a note showing users how to use .serializer(JSON.stringify) to
serialize strings as JSON when needed.
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jan 25, 2026
@mcollina mcollina requested review from Eomm and jsumners January 25, 2026 22:10
Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is appropriate "fix." This specific issue has been on a merry-go-round for years.

@mcollina mcollina merged commit b48826f into main Jan 26, 2026
9 checks passed
@mcollina mcollina deleted the docs/update-reply-send-string-serialization branch January 26, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reply.send(string) does not serialize strings as JSON even if the Content-Type is set to application/json

3 participants