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: ensure request body input is always a string #19

Merged
merged 1 commit into from
Aug 9, 2022

Conversation

const mockedRequest = new MockedRequest(
// Treat all relative URLs as the ones coming from the server.
new URL(req.url, serverOrigin),
{
method: req.method,
headers: new Headers(req.headers as HeadersInit),
credentials: 'omit',
body: encodeBuffer(req.body),
body: encodeBuffer(requestBody),
Copy link
Member Author

Choose a reason for hiding this comment

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

With msw@0.44, the input for the body is always an ArrayBuffer that encodes a plain string. Previously, it was possible passing a plain object as well, that's why the issue surfaced only now.

@kettanaito kettanaito merged commit c1683be into main Aug 9, 2022
@kettanaito kettanaito deleted the fix/stringify-request-body branch August 9, 2022 10:47
@kettanaito
Copy link
Member Author

Released: v0.5.1 🎉

This has been released in v0.5.1!

Make sure to always update to the latest version (npm i @mswjs/http-middleware@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
1 participant