You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to simulate a file upload with progress feedback using MSW (to write frontend for an upcoming API), but am struggling to get the progress event to fire when using MSW.
I've tried a few different approaches and the MSW interception fires correctly, and I can read the sent file content correctly inside the handler and return a response, but nothing seems to trigger the progress event that I would expect.
Reading previous threads on this subject for MSW suggest that support should exist in 2.0+, so this may be a lack of understanding on my part, but I would appreciate some help as to whether this is a bug, an unsupported case or an issue with the implementation.
I have created an isolated reproduction using a vite site base and the axios library here; I have also tried pure XHR with similar lack of success.
Thanks
The text was updated successfully, but these errors were encountered:
@cjpbright, thanks for raising this. In the browser, MSW fully relies on the Service Worker API. If it dispatches the progress event on XHR or not is, unfortunately, not up to us.
One thing that comes to mind, try sending request body as a ReadableStream. I may look into the reproduction repo once I have a moment.
I'm trying to simulate a file upload with progress feedback using MSW (to write frontend for an upcoming API), but am struggling to get the progress event to fire when using MSW.
I've tried a few different approaches and the MSW interception fires correctly, and I can read the sent file content correctly inside the handler and return a response, but nothing seems to trigger the progress event that I would expect.
Reading previous threads on this subject for MSW suggest that support should exist in 2.0+, so this may be a lack of understanding on my part, but I would appreciate some help as to whether this is a bug, an unsupported case or an issue with the implementation.
I have created an isolated reproduction using a vite site base and the axios library here; I have also tried pure XHR with similar lack of success.
Thanks
The text was updated successfully, but these errors were encountered: