Skip to content

feat: Add .json()/.text()/.html()/.stream() context helpers#3613

Merged
marvinhagemeister merged 5 commits into
mainfrom
response-helpers
Nov 11, 2025
Merged

feat: Add .json()/.text()/.html()/.stream() context helpers#3613
marvinhagemeister merged 5 commits into
mainfrom
response-helpers

Conversation

@marvinhagemeister
Copy link
Copy Markdown
Contributor

Played around with Hono in the past days and the .text()/.json()/.html() helpers are kinda neat, even if you can always construct that yourself manually. Also added a .stream() helper to create streams without having to deal with ReadableStream and encodings yourself.

Copy link
Copy Markdown
Member

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

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

This all looks good except the stream one, because it doesn't propagate cancellation into the iterator. Use ReadableStream.from instead?

Also I think the usage examples should be "in context" showing that you need to return the return value.

Comment thread packages/fresh/src/context.ts
@marvinhagemeister marvinhagemeister merged commit 8de5b15 into main Nov 11, 2025
10 checks passed
@marvinhagemeister marvinhagemeister deleted the response-helpers branch November 11, 2025 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants