-
-
Notifications
You must be signed in to change notification settings - Fork 544
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
JSON response with special chars truncated since 2.2.0 #2045
Comments
I left a comment in #1658 but as this is the same problem with mine, I'll copy it here.
![]() |
Root causeRight now, we are relying on the string length to determine the value of the automatic Instead, we should convert the string to buffer and measure its byte length. There are a couple of ways to do that:
Pull requests are welcome! I'd start with a failing test for special characters right here: msw/src/core/HttpResponse.test.ts Line 16 in 23fc364
|
Released: v2.2.2 🎉This has been released in v2.2.2! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
Prerequisites
Environment check
msw
versionNode.js version
20.9.0
Reproduction repository
https://github.com/LeBenLeBen/msw-truncated
Reproduction steps
Clone the reproduction repo, then:
npm install
npm start
Current behavior
The JSON response is truncated a few characters before the end and cannot be parsed by the browser. It’s caused by the special char
é
in the response. The problem does not occur before MSW 2.2.0, so I’m guessing it’s a regression caused by #1658Expected behavior
The JSON response should be complete.
The text was updated successfully, but these errors were encountered: