How to mock axios put or post request with onUploadProgress config using Mock Service Worker #5705
Unanswered
chetankondawle
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hi, @chetankondawle. Have you tried to reproduce this on npm i msw@next Please note that it's a breaking change and you can find detailed Migration guideline on GitHub. Let me know how it goes. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an file upload API, which has a config to check the progress of file being uplaoded using onUploadProgress. It takes a callback, which takes a progressEvent as ain argument, which gives me total file size and uploaded file size.
I tried mocking this particular upload api request with MSW. MSW does not intercept the request and directly the catch block is called in test case. When, I remvoe the onUploadProgress config, MSW intercepts the request and returns the resposne correctly.
How to mock the request which has onUploadProgress config using Mock Service Worker?
Here is the code snippet for axios config.
Form data holds the file object .
Beta Was this translation helpful? Give feedback.
All reactions