Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

fix: deserializeAsync string chunks can split anywhere #30

Merged
merged 3 commits into from
Oct 6, 2023

Conversation

Sheraff
Copy link
Contributor

@Sheraff Sheraff commented Oct 6, 2023

String chunks can split the string anywhere and shouldn't be assumed to imply a new line.

This PR insures that deserializeAsync always accumulates the original string from the received chunks before splitting it into separate lines. Before this change, it was assumed that "end of chunk" means "end of line" even if the \n char wasn't in the original string.

It also adds a test in deserializeAsync that verifies it still works with weird chunk splits. Test didn't pass before this PR, passes now.


Sorry for the branch name / PR formatting, I haven't contributed to tRPC in a while I don't remember the conventions

@Sheraff Sheraff self-assigned this Oct 6, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

PR Compliance Checks

Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.

Issue Reference

In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our Contributing Guide. We are closing this pull request for now but you can update the pull request description and reopen the pull request.
The check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Files Coverage Δ
src/async/asyncTypes.ts 100.00% <100.00%> (ø)
src/async/deserializeAsync.ts 99.25% <93.93%> (-0.75%) ⬇️

📢 Thoughts on this report? Let us know!.

@Sheraff Sheraff changed the title [deserializeAsync] Fix: string chunks can split anywhere fix: deserializeAsync string chunks can split anywhere Oct 6, 2023
@Sheraff Sheraff requested a review from KATT October 6, 2023 08:38
@Sheraff Sheraff merged commit aa19cc4 into main Oct 6, 2023
11 of 13 checks passed
@Sheraff Sheraff deleted the fix/deserialize-async/arbitrary-chunks branch October 6, 2023 09:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants