-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
FormData upload broken after update to msw v2 #6054
Copy link
Copy link
Closed
Description
Describe the bug
After upgrading msw from 1.x to 2.x FormData upload stopped working in tests. Looking at the debugging output, Axios doesn't append the boundary to the Content-Type header anymore.
The MSW team checked [1] this already on their side.
I tried to append the boundary manually to the header for debugging purposes, but that revealed another issue:
{ "Content-Type": "multipart/form-data; boundary=abc" }
ends in
Content-Type: multipart/form-databoundary=abc
[1] mswjs/msw#1835
To Reproduce
Checkout the msw reproducer at [1] and
cd examples/with-vitest
npm install
npm test
[1] https://github.com/pschyma/msw-examples/tree/axios-formdata-reproducer
Code snippet
No response
Expected behavior
As with msw the boundary is appended to Content-Type header.
Axios Version
1.6.0
Adapter Version
XHR
Browser
jsdom
Browser Version
No response
Node.js Version
18.8.2
OS
Linux
Additional Library Versions
msw 2.0.x
vitest 0.34.6Additional context/Screenshots
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels