[PoC] fix: improve Response.json() and Response.redirect() spec compliance and efficiency#343
Open
[PoC] fix: improve Response.json() and Response.redirect() spec compliance and efficiency#343
Conversation
…and efficiency - Throw TypeError for non-JSON-serializable data in Response.json() - Add URL validation with fast-path for common ASCII URLs in Response.redirect() - Remove redundant type assertions in Response.json()
Member
|
Hey @usualoma I have reconsidered. First, I confirmed that the performance of
I said these changes are unnecessary, but the improvement is significant, and the code hasn't increased much. So, let's keep the optimizations for Is this PR ready for review? |
Member
Author
|
Hi @yusukebe Thanks! I hadn't really thought this through because I wasn't sure if the idea would be adopted, but writing it out with a straightforward |
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.

The optimizations for
Response.json()andResponse.redirect()introduced in #333 cause behavior discrepancies with nativeResponseobjects in cases such as those discussed at honojs/hono#2343.While excluding the
Response.json()optimization is under consideration, if it is included as is, I believe we should ensure that there are no behavioral discrepancies with the nativeResponseobject, as proposed in this pull request.What this pull request includes