Closed MeetinaXD closed 3 months ago
I am experiencing the same issue.
I'm using axios within a node environment and onUploadProgress
is not being called either.
Hi! Thanks for raising this.
I've opened a fix at #613, and the XMLHttpRequestInterceptor now correctly emits upload
events for requests with body (tested on multipart/form-data
file uploads).
[!IMPORTANT] This will not be supported in JSDOM. JSDOM does not implement the
upload
events at all, and I always get a singleprogress
event where bothloaded
andtotal
are always0
. That is a different behavior from the browser, where theloaded
andtotal
are calculated correctly. We are going to use browser as the source of truth from now on and disregard any discrepancies JSOM may introduce. If you encounter any, please raise them with the JSDOM maintainers to provide proper implementation.
This has been released in v0.34.2!
Make sure to always update to the latest version (npm i @mswjs/interceptors@latest
) to get the newest features and bug fixes.
Predictable release automation by @ossjs/release.
thank you for explaining the behavior of jsom. it works now. that's amazing and very kind of you, many thanks @kettanaito
Hi, I noticed that #292 mentioned that interceptor has added support for the upload event of XMLHttpRequest, but I tried to use XHR to upload files in the latest version of msw, and the progress event was not triggered.
By the way, #292 mentions adding support for the progress event, but this only works in response.
I'm wondering if it's possible to add support for the progress event in upload?
Environment
To Reproduce