Skip to content
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

fix: stream response chunks as they come in Node.js #1606

Merged
merged 7 commits into from
May 3, 2023

Conversation

kettanaito
Copy link
Member

This needs the Interceptors dependency bump to have the newly added tests pass.

@kettanaito kettanaito changed the base branch from main to feat/standard-api May 3, 2023 17:18
@codesandbox-ci
Copy link

codesandbox-ci bot commented May 3, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 641fea7:

Sandbox Source
MSW React Configuration

// Ensure that the chunks were sent over time,
// respecting the delay set in the mocked stream.
const chunkTimings = chunks.map((chunk) => chunk.timestamp)
expect(chunkTimings[1] - chunkTimings[0]).toBeGreaterThanOrEqual(500)
Copy link
Member Author

Choose a reason for hiding this comment

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

This will fail at the moment because the Interceptors used to consume the entire response stream before setting the this.res = response and emitting the response event on the ClientRequest instance.

That's no longer the case with the fix.

@kettanaito kettanaito changed the title fix: streams response chunks as they come in in Node.js fix: stream response chunks as they come in in Node.js May 3, 2023
@kettanaito kettanaito changed the title fix: stream response chunks as they come in in Node.js fix: stream response chunks as they come in Node.js May 3, 2023
@kettanaito kettanaito merged commit 50c4c9c into feat/standard-api May 3, 2023
11 checks passed
@kettanaito kettanaito deleted the fix/stream-delays branch May 3, 2023 18:14
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.

None yet

1 participant