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: add "application/protobuf" handling test #1443

Merged
merged 3 commits into from
Nov 16, 2023

Conversation

DGollings
Copy link
Contributor

Added test which mimicks the behaviour I see in issue #1442

Simply returns the request, which should remain completely unchanged whilst moving through msw

@codesandbox-ci
Copy link

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 bded29e:

Sandbox Source
MSW React Configuration

@kettanaito
Copy link
Member

We need to re-assess this test in the context of the recent MSW 2.0 release. I have a suspicion that this will no longer be an issue. I will rebase the branch and let's see.

http.post('https://example.com/protobuf', async ({ request }) => {
const buffer = await request.arrayBuffer()

return new HttpResponse(new Uint8Array(buffer), {
Copy link
Member

Choose a reason for hiding this comment

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

@DGollings, hi 👋 Do you think it's necessary to preserve this conversion here or should be simply forward the buffer as-is to the response? It'd also change how we assert the actual response body sent back.

In any case, the test is now passing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I honestly don't remember why that conversion is there, maybe to be slightly more realistic to actual usage? You generally don't respond with the exact request as-is (I think? Its been over a year)

@kettanaito kettanaito changed the title test: added (currently broken) protobuf parsing test test: add "application/protobuf" handling test Nov 16, 2023
@kettanaito kettanaito merged commit c652d90 into mswjs:main Nov 16, 2023
8 checks passed
@kettanaito
Copy link
Member

Released: v2.0.7 🎉

This has been released in v2.0.7!

Make sure to always update to the latest version (npm i msw@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.

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