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

test(browser): add ReadableStream response body test #1770

Merged
merged 1 commit into from
Oct 15, 2023

Conversation

kettanaito
Copy link
Member

No description provided.

@kettanaito
Copy link
Member Author

Hey, @thepassle. I've added this browser integration test for a readable stream mock response body and it doesn't require setting the duplex option either. Could you give this a quick look if everything's alright? Thanks.

@thepassle
Copy link
Contributor

Ah, the duplex is required in Request, not Response:

a = new Request('/api/foo', {
  method: 'POST',
  body: new ReadableStream()
});

results in:
Uncaught TypeError: Failed to construct 'Request': The duplex member must be specified for a request with a streaming body

See also: https://developer.chrome.com/articles/fetch-streaming-requests/#half-duplex

@kettanaito
Copy link
Member Author

@thepassle, yeah, that's right. You need that option to send a readable stream. That needs no testing on MSW's side because the way you construct the request is up to you and it has to be correct. Thanks for verifying that 👍

@kettanaito kettanaito merged commit b028c66 into feat/standard-api Oct 15, 2023
9 checks passed
@kettanaito kettanaito deleted the test/body-stream branch October 15, 2023 11:31
@thepassle
Copy link
Contributor

Yeah, looks like I got things mixed up :) my bad!

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.

2 participants