Skip to content

fix: Skip content-length assignment when transfer-encoding is chunked. #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2025

Conversation

usualoma
Copy link
Member

fixes #270

In responseViaCache, we avoided searching for Transfer-Encoding because it was computationally expensive when the header object passed was a Record<string, string>. However, in this case, we assume that the body is not chunked if it is a string or Blob, so we would like to process it based on that assumption. (This has actually been the behavior so far.)
In responseViaResponseObject, we had also avoided referencing Transfer-Encoding to align with responseViaCache, but since there are actual issues like #270, I would like to avoid setting Content-Length if Transfer-Encoding is chunked.

@usualoma
Copy link
Member Author

@yusukebe
Would you please review this?

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

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

LGTM!

@yusukebe
Copy link
Member

@usualoma

Thank you for the quick fix. Looks good! Merging.

@yusukebe yusukebe merged commit df6ea8e into honojs:main Aug 12, 2025
5 checks passed
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.

Issue when using @hono/mcp, content-length is included when chunked encoding is used.
2 participants