Repository navigation
refactor: parse JSON responses via Response.json() instead of manual JSON.parse - #22
Merged
Merged
Conversation
…JSON.parse Response.json() already parses JSON and rejects on invalid input, so the manual text()+JSON.parse() step is unnecessary except on the GET+cache path, where the raw text is still needed for the cache entry.
test: Run #37
🎉 All tests passed!Github Test Reporter by CTRF 💚 |
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.
Summary
performRequestnow callsResponse.json()directly for JSON responses that don't need to be cached, instead of manually reading text and callingJSON.parseon it (reviewer feedback on thebeforeRequesthook PR).GET+cache-configured path is unchanged: it still reads the body as text once, since that raw text is also persisted to the cache entry.FetchifyResponseshape, or cache entry format —data,response, andcachedbehave identically to before.Test plan
bun test— 199 pass, 0 failbun run lint— cleanGET: confirmsdatastill parses correctly and the cache adapter receives the exact raw text bodyResponse.json()path🤖 Generated with Claude Code