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
Access raw request body as buffer #1302
Comments
Hey, @95th. Thanks for raising this. We currently handle all request/response bodies as strings. This has been a limitation imposed by the message channel between the worker and the client, but I have recently learned that that's not the case. You can send Focusing on the request body in particular, the What I'd love to have is to extend a default fetch There are challenges to this, of course. As MSW executes the same handlers in both browser and Node, it wouldn't be able to do
|
We've finished with the preparations for this on the interceptor's side. Will roll this out to MSW as the next step. Meanwhile, I've opened a pull request (mswjs/mswjs.io#207) that updates the docs on how to read the request body after this change. -req.body
+await req.text()
+await req.json()
+await req.arrayBuffer() |
Phase 1To preserve backward compatibility, we will keep
@95th, this deprecation may be tricky to implement since One of the ways we could approach this is by moving Phase 2I think we need to let the |
Released: v0.44.0 🎉This has been released in v0.44.0! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
Scope
Adds a new behavior
Compatibility
Feature description
Allow accessing raw request body as buffer
The text was updated successfully, but these errors were encountered: